setwd("~/Documents/GitHub/Resultados/docs/PrimeroDiffExpAllResults/Clasificando/Abundances")
load('CheackPointOne.RData')

Presentacion

Primera Clasificacion: pEhEx

head(pEhExvsCDC5,10);
##          GenId     CDC5_1    CDC5_2     CDC5_3    pEhEx_1    pEhEx_2    pEhEx_3
## 1  EHI_000130A  72.594848  40.99764  280.54541  169.92967  411.34855  466.86626
## 2  EHI_000140A 111.027415 145.24877  643.77044  342.73950  324.16054   37.85402
## 3  EHI_000240A 876.831894 752.01378 1122.88829 1140.54489 1837.65493 2071.45616
## 4  EHI_000250A 492.506226 510.71341  232.49229  315.37794  310.74700  642.81736
## 5  EHI_000260A  12.810856 107.76521    2.11999  105.84602   63.71431   49.07003
## 6  EHI_000280A  58.360564  42.16900  171.71923   53.28303   79.36344   60.28603
## 7  EHI_000290A  17.081141  26.94130   14.13327   18.00102   13.41354   79.21304
## 8  EHI_000300A  49.819994  70.28166   48.05312  129.60737  109.54391   30.84402
## 9  EHI_000410A  14.234284  19.91314   52.29310   27.36156   23.47369   63.79104
## 10 EHI_000430A   9.963999  25.76994    2.11999   25.20143   13.41354   10.51501
nbreaks <- 10
data1 <- pEhExvsCDC5;       head(data1)
##         GenId    CDC5_1    CDC5_2     CDC5_3    pEhEx_1    pEhEx_2    pEhEx_3
## 1 EHI_000130A  72.59485  40.99764  280.54541  169.92967  411.34855  466.86626
## 2 EHI_000140A 111.02742 145.24877  643.77044  342.73950  324.16054   37.85402
## 3 EHI_000240A 876.83189 752.01378 1122.88829 1140.54489 1837.65493 2071.45616
## 4 EHI_000250A 492.50623 510.71341  232.49229  315.37794  310.74700  642.81736
## 5 EHI_000260A  12.81086 107.76521    2.11999  105.84602   63.71431   49.07003
## 6 EHI_000280A  58.36056  42.16900  171.71923   53.28303   79.36344   60.28603

Log-Normalización

sample1   <- data1$pEhEx_1; sample2   <- data1$pEhEx_2; sample3   <- data1$pEhEx_3;
samplevs1 <- data1$CDC5_1;  samplevs2 <- data1$CDC5_2;  samplevs3 <- data1$CDC5_3;
log2sample1 <- log2(sample1+1);         log2sample2 <- log2(sample2+1)
log2sample3 <- log2(sample3+1);         log2samplevsCDC51 <- log2(samplevs1+1)
log2samplevsCDC52 <- log2(samplevs2+1); log2samplevsCDC53 <- log2(samplevs3+1)
data1 <- cbind(data1, log2sample1,log2sample2,log2sample3,
               log2samplevsCDC51,log2samplevsCDC52,log2samplevsCDC53)
head(data1)
##         GenId    CDC5_1    CDC5_2     CDC5_3    pEhEx_1    pEhEx_2    pEhEx_3
## 1 EHI_000130A  72.59485  40.99764  280.54541  169.92967  411.34855  466.86626
## 2 EHI_000140A 111.02742 145.24877  643.77044  342.73950  324.16054   37.85402
## 3 EHI_000240A 876.83189 752.01378 1122.88829 1140.54489 1837.65493 2071.45616
## 4 EHI_000250A 492.50623 510.71341  232.49229  315.37794  310.74700  642.81736
## 5 EHI_000260A  12.81086 107.76521    2.11999  105.84602   63.71431   49.07003
## 6 EHI_000280A  58.36056  42.16900  171.71923   53.28303   79.36344   60.28603
##   log2sample1 log2sample2 log2sample3 log2samplevsCDC51 log2samplevsCDC52
## 1    7.417259    8.687721    8.869952          6.201533          5.392236
## 2    8.425172    8.345008    5.279992          6.807708          7.192281
## 3   10.156772   10.844435   11.017126          9.777801          9.556532
## 4    8.305505    8.284232    9.330508          8.946924          8.999192
## 5    6.739389    6.016013    5.645875          3.787731          6.765073
## 6    5.762429    6.328467    5.937486          5.891433          5.431924
##   log2samplevsCDC53
## 1          8.137224
## 2          9.332642
## 3         10.134283
## 4          7.867231
## 5          1.641542
## 6          7.432285
save.image('CheckPointTwo.RData')
setwd("~/Documents/GitHub/Resultados/docs/PrimeroDiffExpAllResults/Clasificando/Abundances")
#load('CheckPointTwo.RData')
library(ggplot2);library(dplyr);library("fitdistrplus");
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
## Loading required package: MASS
## 
## Attaching package: 'MASS'
## The following object is masked from 'package:dplyr':
## 
##     select
## Loading required package: survival
library("MASS");library("survival")
head(data1)
##         GenId    CDC5_1    CDC5_2     CDC5_3    pEhEx_1    pEhEx_2    pEhEx_3
## 1 EHI_000130A  72.59485  40.99764  280.54541  169.92967  411.34855  466.86626
## 2 EHI_000140A 111.02742 145.24877  643.77044  342.73950  324.16054   37.85402
## 3 EHI_000240A 876.83189 752.01378 1122.88829 1140.54489 1837.65493 2071.45616
## 4 EHI_000250A 492.50623 510.71341  232.49229  315.37794  310.74700  642.81736
## 5 EHI_000260A  12.81086 107.76521    2.11999  105.84602   63.71431   49.07003
## 6 EHI_000280A  58.36056  42.16900  171.71923   53.28303   79.36344   60.28603
##   log2sample1 log2sample2 log2sample3 log2samplevsCDC51 log2samplevsCDC52
## 1    7.417259    8.687721    8.869952          6.201533          5.392236
## 2    8.425172    8.345008    5.279992          6.807708          7.192281
## 3   10.156772   10.844435   11.017126          9.777801          9.556532
## 4    8.305505    8.284232    9.330508          8.946924          8.999192
## 5    6.739389    6.016013    5.645875          3.787731          6.765073
## 6    5.762429    6.328467    5.937486          5.891433          5.431924
##   log2samplevsCDC53
## 1          8.137224
## 2          9.332642
## 3         10.134283
## 4          7.867231
## 5          1.641542
## 6          7.432285

Muestra 1

log2sample1 <- data1$log2sample1; head(mean(log2sample1)); head(sd(log2sample1))
## [1] 6.30237
## [1] 2.868113
head(log2sample1,5)
## [1]  7.417259  8.425172 10.156772  8.305505  6.739389
summary(data1)
##     GenId               CDC5_1              CDC5_2              CDC5_3        
##  Length:4772        Min.   :     0.00   Min.   :     0.00   Min.   :     0.0  
##  Class :character   1st Qu.:    17.08   1st Qu.:    17.57   1st Qu.:    16.3  
##  Mode  :character   Median :    45.55   Median :    49.20   Median :    44.5  
##                     Mean   :  1749.28   Mean   :  1748.01   Mean   :  1980.0  
##                     3rd Qu.:   196.79   3rd Qu.:   208.50   3rd Qu.:   177.4  
##                     Max.   :270953.87   Max.   :270338.41   Max.   :481876.0  
##     pEhEx_1            pEhEx_2             pEhEx_3          log2sample1    
##  Min.   :     0.0   Min.   :     0.00   Min.   :     0.0   Min.   : 0.000  
##  1st Qu.:    18.0   1st Qu.:    15.65   1st Qu.:    15.4   1st Qu.: 4.248  
##  Median :    50.4   Median :    49.18   Median :    54.0   Median : 5.684  
##  Mean   :  1395.0   Mean   :  1717.64   Mean   :  1909.2   Mean   : 6.302  
##  3rd Qu.:   208.1   3rd Qu.:   223.84   3rd Qu.:   242.0   3rd Qu.: 7.708  
##  Max.   :207266.7   Max.   :265749.05   Max.   :707261.7   Max.   :17.661  
##   log2sample2      log2sample3     log2samplevsCDC51 log2samplevsCDC52
##  Min.   : 0.000   Min.   : 0.000   Min.   : 0.000    Min.   : 0.000   
##  1st Qu.: 4.057   1st Qu.: 4.038   1st Qu.: 4.176    1st Qu.: 4.215   
##  Median : 5.649   Median : 5.781   Median : 5.541    Median : 5.650   
##  Mean   : 6.237   Mean   : 6.186   Mean   : 6.244    Mean   : 6.270   
##  3rd Qu.: 7.813   3rd Qu.: 7.925   3rd Qu.: 7.628    3rd Qu.: 7.711   
##  Max.   :18.020   Max.   :19.432   Max.   :18.048    Max.   :18.044   
##  log2samplevsCDC53
##  Min.   : 0.000   
##  1st Qu.: 4.109   
##  Median : 5.508   
##  Mean   : 6.114   
##  3rd Qu.: 7.479   
##  Max.   :18.878
ndata1    <- length(log2sample1)
hist(log2sample1, breaks = nbreaks, col= rainbow(25,0.3), 
     main = 'Log2 sample1')

meanlog2sample1 <- mean(log2sample1); head(meanlog2sample1)
## [1] 6.30237
StdDevlog2sample1 <- sd(log2sample1); head(StdDevlog2sample1)
## [1] 2.868113
Normlog2sample1 <- (log2sample1-meanlog2sample1)/StdDevlog2sample1; head(Normlog2sample1)
## [1]  0.3887185  0.7401387  1.3438805  0.6984156  0.1523717 -0.1882564
tst<- Normlog2sample1

hist(tst, breaks = nbreaks, col= 1:5, 
     main = 'Normalized Log2sample1',
     xlab='pEhEx1',
     ylab= 'Frequency pEhEx')

fw1<-fitdist(tst, "norm")
plotdist(tst, histo = TRUE, demp = TRUE)

nnorm.f <- fitdist(tst,"norm")
summary(nnorm.f)
## Fitting of the distribution ' norm ' by maximum likelihood 
## Parameters : 
##           estimate Std. Error
## mean -9.053474e-17 0.01447452
## sd    9.998952e-01 0.01023499
## Loglikelihood:  -6770.675   AIC:  13545.35   BIC:  13558.29 
## Correlation matrix:
##      mean sd
## mean    1  0
## sd      0  1
par(mfrow=c(2,2))
denscomp(nnorm.f,legendtext = 'Dist Normal')
qqcomp(nnorm.f,legendtext = 'Dist Normal')
cdfcomp(nnorm.f,legendtext = 'Dist Normal')
ppcomp(nnorm.f,legendtext = 'Dist Normal')

probs <- c();
probs[8] = 0.175;  probs[9] = 0.825; 
probs[7] = 0.15;   probs[10] = 0.85;   
probs[6] = 0.125;  probs[11] = 0.875; 
probs[5] = 0.1;    probs[12] = 0.9;    
probs[4] = 0.075;  probs[13] = 0.925; 
probs[3] = 0.05;   probs[14] = 0.95;   
probs[2] = 0.025;  probs[15] = 0.975; 
probs[1] = 0.005;  probs[16] = 0.995;  
CuantilesData <- quantile(tst,prob = probs)
CuantilesModel <- qnorm(probs, mean=0, sd=1)
Cuantilillos <- t(CuantilesModel)
colnames(Cuantilillos) <- c('0.5%','2.5%','5%','7.5%',
                            '10%','12.5%','15%','17.5%',
                            '82.5%','85%','87.5%','90%',
                            '92.5%','95%','97.5%','99.5%')
Cuantilillos <- t(Cuantilillos)
colnames(Cuantilillos) <- c('Cuantiles Ajuste')
print(Cuantilillos)
##       Cuantiles Ajuste
## 0.5%        -2.5758293
## 2.5%        -1.9599640
## 5%          -1.6448536
## 7.5%        -1.4395315
## 10%         -1.2815516
## 12.5%       -1.1503494
## 15%         -1.0364334
## 17.5%       -0.9345893
## 82.5%        0.9345893
## 85%          1.0364334
## 87.5%        1.1503494
## 90%          1.2815516
## 92.5%        1.4395315
## 95%          1.6448536
## 97.5%        1.9599640
## 99.5%        2.5758293

Cálculo de cuantiles

CuantilesA <- matrix(0,8,2)
CuantilesD <- matrix(0,8,2)
colnames(CuantilesA) <- c('LimInf','LimSup')
colnames(CuantilesD) <- c('LimInf','LimSup')
rownames(CuantilesA) <- c('65','70','75','80','85','90','95','99')
rownames(CuantilesD) <- c('65','70','75','80','85','90','95','99')
CuantilesA[1,1] <-CuantilesData[8]; CuantilesA[1,2] <-CuantilesData[9]
CuantilesA[2,1] <-CuantilesData[7]; CuantilesA[2,2] <-CuantilesData[10]
CuantilesA[3,1] <-CuantilesData[6]; CuantilesA[3,2] <-CuantilesData[11]
CuantilesA[4,1] <-CuantilesData[5]; CuantilesA[4,2] <-CuantilesData[12]
CuantilesA[5,1] <-CuantilesData[4]; CuantilesA[5,2] <-CuantilesData[13]
CuantilesA[6,1] <-CuantilesData[3]; CuantilesA[6,2] <-CuantilesData[14]
CuantilesA[7,1] <-CuantilesData[2]; CuantilesA[7,2] <-CuantilesData[15]
CuantilesA[8,1] <-CuantilesData[1]; CuantilesA[8,2] <-CuantilesData[16]
CuantilesD[1,1] <-Cuantilillos[8];  CuantilesD[1,2] <-Cuantilillos[9]
CuantilesD[2,1] <-Cuantilillos[7];  CuantilesD[2,2] <-Cuantilillos[10]
CuantilesD[3,1] <-Cuantilillos[6];  CuantilesD[3,2] <-Cuantilillos[11]
CuantilesD[4,1] <-Cuantilillos[5];  CuantilesD[4,2] <-Cuantilillos[12]
CuantilesD[5,1] <-Cuantilillos[4];  CuantilesD[5,2] <-Cuantilillos[13]
CuantilesD[6,1] <-Cuantilillos[3];  CuantilesD[6,2] <-Cuantilillos[14]
CuantilesD[7,1] <-Cuantilillos[2];  CuantilesD[7,2] <-Cuantilillos[15]
CuantilesD[8,1] <-Cuantilillos[1];  CuantilesD[8,2] <-Cuantilillos[16]
print(CuantilesD)
##        LimInf    LimSup
## 65 -0.9345893 0.9345893
## 70 -1.0364334 1.0364334
## 75 -1.1503494 1.1503494
## 80 -1.2815516 1.2815516
## 85 -1.4395315 1.4395315
## 90 -1.6448536 1.6448536
## 95 -1.9599640 1.9599640
## 99 -2.5758293 2.5758293
print(CuantilesA)
##        LimInf    LimSup
## 65 -0.8713278 0.8126272
## 70 -0.9260903 0.9617987
## 75 -0.9875514 1.1301158
## 80 -1.0213487 1.3734820
## 85 -1.0966280 1.6988689
## 90 -1.1851905 2.1819106
## 95 -1.3565981 2.6079805
## 99 -1.9245847 3.1666752
col_sequence <- rainbow(n = 7, alpha = 0.35, start = 0, end = 1)
par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2 pEhEx - DATA', lty = 9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[2,1], lty=2, col="darkblue"); # 70% INFERIOR
abline(v=CuantilesA[2,2], lty=2, col="darkblue") # 70% SUPERIOR
abline(v=CuantilesA[3,1], lty=2, col="aquamarine4"); # 75% INFERIOR
abline(v=CuantilesA[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesA[5,1], lty=2, col="brown"); # 85% INFERIOR
abline(v=CuantilesA[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesA[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesA[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesA[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesA[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesA[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesA[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2   pEhEx - ADJUSTED', lty=9)
abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[2,1], lty=2, col="darkblue");  # 70% INFERIOR
abline(v=CuantilesD[2,2], lty=2, col="darkblue"); # 70% SUPERIOR
abline(v=CuantilesD[3,1], lty=2, col="aquamarine4");  # 75% INFERIOR
abline(v=CuantilesD[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesD[5,1], lty=2, col="brown");  # 85% INFERIOR
abline(v=CuantilesD[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesD[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesD[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesD[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesD[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesD[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesD[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))

Grafica Cuantiles del \(65\%\) y \(80\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2  pEhEx - DATA', lty=9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2  BaseMean - ADJUSTED', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))

Grafica Cuantiles del \(70\%\) y \(85\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence, 
     main = 'Normalized Log2 pEhEx - DATA', lty=9)

abline(v=CuantilesA[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesA[2,2], lty=2, col="darkblue")
abline(v=CuantilesA[5,1], lty=2, col="brown"); 
abline(v=CuantilesA[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2  pEhEx - ADJUSTED', lty=9)

abline(v=CuantilesD[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesD[2,2], lty=2, col="darkblue")
abline(v=CuantilesD[5,1], lty=2, col="brown"); 
abline(v=CuantilesD[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))

Muestra 2

log2sample2 <- data1$log2sample2; head(mean(log2sample2)); head(sd(log2sample2))
## [1] 6.237216
## [1] 3.103083
head(log2sample2,5)
## [1]  8.687721  8.345008 10.844435  8.284232  6.016013
ndata1    <- length(log2sample2)
hist(log2sample2, breaks = nbreaks, col= rainbow(25,0.3), 
     main = 'Log2 sample2')

Log-normalizacion

meanlog2sample2 <- mean(log2sample2); head(meanlog2sample2)
## [1] 6.237216
StdDevlog2sample2 <- sd(log2sample2); head(StdDevlog2sample2)
## [1] 3.103083
Normlog2sample2 <- (log2sample2-meanlog2sample2)/StdDevlog2sample2; head(Normlog2sample2)
## [1]  0.78969998  0.67925752  1.48472313  0.65967167 -0.07128491  0.02940674
tst<- Normlog2sample2
hist(tst, breaks = nbreaks, col= 1:5, 
     main = 'Normalized Log2sample1',
     xlab='pEhEx1',
     ylab= 'Frequency pEhEx')

Ajuste de modelo

fw1<-fitdist(tst, "norm")
plotdist(tst, histo = TRUE, demp = TRUE)

nnorm.f <- fitdist(tst,"norm")
summary(nnorm.f)
## Fitting of the distribution ' norm ' by maximum likelihood 
## Parameters : 
##           estimate Std. Error
## mean -1.260395e-16 0.01447452
## sd    9.998952e-01 0.01023499
## Loglikelihood:  -6770.675   AIC:  13545.35   BIC:  13558.29 
## Correlation matrix:
##      mean sd
## mean    1  0
## sd      0  1
par(mfrow=c(2,2))
denscomp(nnorm.f,legendtext = 'Dist Normal')
qqcomp(nnorm.f,legendtext = 'Dist Normal')
cdfcomp(nnorm.f,legendtext = 'Dist Normal')
ppcomp(nnorm.f,legendtext = 'Dist Normal')

probs <- c();
probs[8] = 0.175;  probs[9] = 0.825; 
probs[7] = 0.15;   probs[10] = 0.85;   
probs[6] = 0.125;  probs[11] = 0.875; 
probs[5] = 0.1;    probs[12] = 0.9;    
probs[4] = 0.075;  probs[13] = 0.925; 
probs[3] = 0.05;   probs[14] = 0.95;   
probs[2] = 0.025;  probs[15] = 0.975; 
probs[1] = 0.005;  probs[16] = 0.995;  
CuantilesData <- quantile(tst,prob = probs)
CuantilesModel <- qnorm(probs, mean=0, sd=1)
Cuantilillos <- t(CuantilesModel)
colnames(Cuantilillos) <- c('0.5%','2.5%','5%','7.5%',
                            '10%','12.5%','15%','17.5%',
                            '82.5%','85%','87.5%','90%',
                            '92.5%','95%','97.5%','99.5%')
Cuantilillos <- t(Cuantilillos)
colnames(Cuantilillos) <- c('Cuantiles Ajuste')
print(Cuantilillos)
##       Cuantiles Ajuste
## 0.5%        -2.5758293
## 2.5%        -1.9599640
## 5%          -1.6448536
## 7.5%        -1.4395315
## 10%         -1.2815516
## 12.5%       -1.1503494
## 15%         -1.0364334
## 17.5%       -0.9345893
## 82.5%        0.9345893
## 85%          1.0364334
## 87.5%        1.1503494
## 90%          1.2815516
## 92.5%        1.4395315
## 95%          1.6448536
## 97.5%        1.9599640
## 99.5%        2.5758293
CuantilesA <- matrix(0,8,2)
CuantilesD <- matrix(0,8,2)
colnames(CuantilesA) <- c('LimInf','LimSup')
colnames(CuantilesD) <- c('LimInf','LimSup')
rownames(CuantilesA) <- c('65','70','75','80','85','90','95','99')
rownames(CuantilesD) <- c('65','70','75','80','85','90','95','99')
CuantilesA[1,1] <-CuantilesData[8]; CuantilesA[1,2] <-CuantilesData[9]
CuantilesA[2,1] <-CuantilesData[7]; CuantilesA[2,2] <-CuantilesData[10]
CuantilesA[3,1] <-CuantilesData[6]; CuantilesA[3,2] <-CuantilesData[11]
CuantilesA[4,1] <-CuantilesData[5]; CuantilesA[4,2] <-CuantilesData[12]
CuantilesA[5,1] <-CuantilesData[4]; CuantilesA[5,2] <-CuantilesData[13]
CuantilesA[6,1] <-CuantilesData[3]; CuantilesA[6,2] <-CuantilesData[14]
CuantilesA[7,1] <-CuantilesData[2]; CuantilesA[7,2] <-CuantilesData[15]
CuantilesA[8,1] <-CuantilesData[1]; CuantilesA[8,2] <-CuantilesData[16]
CuantilesD[1,1] <-Cuantilillos[8];  CuantilesD[1,2] <-Cuantilillos[9]
CuantilesD[2,1] <-Cuantilillos[7];  CuantilesD[2,2] <-Cuantilillos[10]
CuantilesD[3,1] <-Cuantilillos[6];  CuantilesD[3,2] <-Cuantilillos[11]
CuantilesD[4,1] <-Cuantilillos[5];  CuantilesD[4,2] <-Cuantilillos[12]
CuantilesD[5,1] <-Cuantilillos[4];  CuantilesD[5,2] <-Cuantilillos[13]
CuantilesD[6,1] <-Cuantilillos[3];  CuantilesD[6,2] <-Cuantilillos[14]
CuantilesD[7,1] <-Cuantilillos[2];  CuantilesD[7,2] <-Cuantilillos[15]
CuantilesD[8,1] <-Cuantilillos[1];  CuantilesD[8,2] <-Cuantilillos[16]

print(CuantilesD)
##        LimInf    LimSup
## 65 -0.9345893 0.9345893
## 70 -1.0364334 1.0364334
## 75 -1.1503494 1.1503494
## 80 -1.2815516 1.2815516
## 85 -1.4395315 1.4395315
## 90 -1.6448536 1.6448536
## 95 -1.9599640 1.9599640
## 99 -2.5758293 2.5758293
print(CuantilesA)
##        LimInf    LimSup
## 65 -0.8926336 0.8466541
## 70 -0.9421687 0.9875692
## 75 -0.9976178 1.1428700
## 80 -1.0605870 1.3752461
## 85 -1.1334411 1.6895575
## 90 -1.2198720 2.1202686
## 95 -1.4640882 2.5136403
## 99 -2.0100061 3.0865078
col_sequence <- rainbow(n = 7, alpha = 0.35, start = 0, end = 1)
par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2 pEhEx - DATA (sample 2)', lty = 9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[2,1], lty=2, col="darkblue"); # 70% INFERIOR
abline(v=CuantilesA[2,2], lty=2, col="darkblue") # 70% SUPERIOR
abline(v=CuantilesA[3,1], lty=2, col="aquamarine4"); # 75% INFERIOR
abline(v=CuantilesA[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesA[5,1], lty=2, col="brown"); # 85% INFERIOR
abline(v=CuantilesA[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesA[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesA[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesA[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesA[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesA[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesA[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2   pEhEx - ADJUSTED (sample 2)', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[2,1], lty=2, col="darkblue");  # 70% INFERIOR
abline(v=CuantilesD[2,2], lty=2, col="darkblue"); # 70% SUPERIOR
abline(v=CuantilesD[3,1], lty=2, col="aquamarine4");  # 75% INFERIOR
abline(v=CuantilesD[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesD[5,1], lty=2, col="brown");  # 85% INFERIOR
abline(v=CuantilesD[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesD[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesD[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesD[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesD[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesD[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesD[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))

Grafica Cuantiles del \(65\%\) y \(80\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2  pEhEx - DATA (sample 2)', lty=9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2  BaseMean - ADJUSTED (sample 2)', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))

Grafica Cuantiles del \(70\%\) y \(85\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence, 
     main = 'Normalized Log2 pEhEx - DATA (sample 2)', lty=9)

abline(v=CuantilesA[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesA[2,2], lty=2, col="darkblue")
abline(v=CuantilesA[5,1], lty=2, col="brown"); 
abline(v=CuantilesA[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2  pEhEx - ADJUSTED (sample 2)', lty=9)

abline(v=CuantilesD[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesD[2,2], lty=2, col="darkblue")
abline(v=CuantilesD[5,1], lty=2, col="brown"); 
abline(v=CuantilesD[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))

Muestra 3

log2sample3 <- data1$log2sample3; head(mean(log2sample3)); head(sd(log2sample3))
## [1] 6.186357
## [1] 3.171257
head(log2sample3,5)
## [1]  8.869952  5.279992 11.017126  9.330508  5.645875
ndata1    <- length(log2sample3)
hist(log2sample3, breaks = nbreaks, col= rainbow(25,0.3), 
     main = 'Log2 sample2')

meanlog2sample3 <- mean(log2sample3); head(meanlog2sample3)
## [1] 6.186357
StdDevlog2sample3 <- sd(log2sample3); head(StdDevlog2sample3)
## [1] 3.171257
Normlog2sample3 <- (log2sample3-meanlog2sample3)/StdDevlog2sample3; head(Normlog2sample3)
## [1]  0.84622446 -0.28580629  1.52329778  0.99145245 -0.17043143 -0.07847701
tst<- Normlog2sample3
hist(tst, breaks = nbreaks, col= 1:5, 
     main = 'Normalized Log2sample1',
     xlab='pEhEx1',
     ylab= 'Frequency pEhEx')

Ajustando Modelos

fw1<-fitdist(tst, "norm")
plotdist(tst, histo = TRUE, demp = TRUE)

nnorm.f <- fitdist(tst,"norm")
summary(nnorm.f)
## Fitting of the distribution ' norm ' by maximum likelihood 
## Parameters : 
##          estimate Std. Error
## mean 2.945427e-17 0.01447452
## sd   9.998952e-01 0.01023499
## Loglikelihood:  -6770.675   AIC:  13545.35   BIC:  13558.29 
## Correlation matrix:
##              mean           sd
## mean 1.000000e+00 1.684231e-11
## sd   1.684231e-11 1.000000e+00
par(mfrow=c(2,2))
denscomp(nnorm.f,legendtext = 'Dist Normal')
qqcomp(nnorm.f,legendtext = 'Dist Normal')
cdfcomp(nnorm.f,legendtext = 'Dist Normal')
ppcomp(nnorm.f,legendtext = 'Dist Normal')

probs <- c();
probs[8] = 0.175;  probs[9] = 0.825; 
probs[7] = 0.15;   probs[10] = 0.85;   
probs[6] = 0.125;  probs[11] = 0.875; 
probs[5] = 0.1;    probs[12] = 0.9;    
probs[4] = 0.075;  probs[13] = 0.925; 
probs[3] = 0.05;   probs[14] = 0.95;   
probs[2] = 0.025;  probs[15] = 0.975; 
probs[1] = 0.005;  probs[16] = 0.995;  
CuantilesData <- quantile(tst,prob = probs)
CuantilesModel <- qnorm(probs, mean=0, sd=1)
Cuantilillos <- t(CuantilesModel)
colnames(Cuantilillos) <- c('0.5%','2.5%','5%','7.5%',
                            '10%','12.5%','15%','17.5%',
                            '82.5%','85%','87.5%','90%',
                            '92.5%','95%','97.5%','99.5%')
Cuantilillos <- t(Cuantilillos)
colnames(Cuantilillos) <- c('Cuantiles Ajuste')
print(Cuantilillos)
##       Cuantiles Ajuste
## 0.5%        -2.5758293
## 2.5%        -1.9599640
## 5%          -1.6448536
## 7.5%        -1.4395315
## 10%         -1.2815516
## 12.5%       -1.1503494
## 15%         -1.0364334
## 17.5%       -0.9345893
## 82.5%        0.9345893
## 85%          1.0364334
## 87.5%        1.1503494
## 90%          1.2815516
## 92.5%        1.4395315
## 95%          1.6448536
## 97.5%        1.9599640
## 99.5%        2.5758293
CuantilesA <- matrix(0,8,2)
CuantilesD <- matrix(0,8,2)
colnames(CuantilesA) <- c('LimInf','LimSup')
colnames(CuantilesD) <- c('LimInf','LimSup')
rownames(CuantilesA) <- c('65','70','75','80','85','90','95','99')
rownames(CuantilesD) <- c('65','70','75','80','85','90','95','99')
CuantilesA[1,1] <-CuantilesData[8]; CuantilesA[1,2] <-CuantilesData[9]
CuantilesA[2,1] <-CuantilesData[7]; CuantilesA[2,2] <-CuantilesData[10]
CuantilesA[3,1] <-CuantilesData[6]; CuantilesA[3,2] <-CuantilesData[11]
CuantilesA[4,1] <-CuantilesData[5]; CuantilesA[4,2] <-CuantilesData[12]
CuantilesA[5,1] <-CuantilesData[4]; CuantilesA[5,2] <-CuantilesData[13]
CuantilesA[6,1] <-CuantilesData[3]; CuantilesA[6,2] <-CuantilesData[14]
CuantilesA[7,1] <-CuantilesData[2]; CuantilesA[7,2] <-CuantilesData[15]
CuantilesA[8,1] <-CuantilesData[1]; CuantilesA[8,2] <-CuantilesData[16]
CuantilesD[1,1] <-Cuantilillos[8];  CuantilesD[1,2] <-Cuantilillos[9]
CuantilesD[2,1] <-Cuantilillos[7];  CuantilesD[2,2] <-Cuantilillos[10]
CuantilesD[3,1] <-Cuantilillos[6];  CuantilesD[3,2] <-Cuantilillos[11]
CuantilesD[4,1] <-Cuantilillos[5];  CuantilesD[4,2] <-Cuantilillos[12]
CuantilesD[5,1] <-Cuantilillos[4];  CuantilesD[5,2] <-Cuantilillos[13]
CuantilesD[6,1] <-Cuantilillos[3];  CuantilesD[6,2] <-Cuantilillos[14]
CuantilesD[7,1] <-Cuantilillos[2];  CuantilesD[7,2] <-Cuantilillos[15]
CuantilesD[8,1] <-Cuantilillos[1];  CuantilesD[8,2] <-Cuantilillos[16]
print(CuantilesD)
##        LimInf    LimSup
## 65 -0.9345893 0.9345893
## 70 -1.0364334 1.0364334
## 75 -1.1503494 1.1503494
## 80 -1.2815516 1.2815516
## 85 -1.4395315 1.4395315
## 90 -1.6448536 1.6448536
## 95 -1.9599640 1.9599640
## 99 -2.5758293 2.5758293
print(CuantilesA)
##        LimInf    LimSup
## 65 -0.8676459 0.8379706
## 70 -0.9660265 0.9701830
## 75 -1.0458574 1.1161493
## 80 -1.1427428 1.3265284
## 85 -1.2660057 1.6213606
## 90 -1.4356115 2.0178765
## 95 -1.7090932 2.4795401
## 99 -1.9507587 3.0829063

Creación de histogramas

col_sequence <- rainbow(n = 7, alpha = 0.35, start = 0, end = 1)
par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2 pEhEx - DATA (sample 3)', lty = 9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[2,1], lty=2, col="darkblue"); # 70% INFERIOR
abline(v=CuantilesA[2,2], lty=2, col="darkblue") # 70% SUPERIOR
abline(v=CuantilesA[3,1], lty=2, col="aquamarine4"); # 75% INFERIOR
abline(v=CuantilesA[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesA[5,1], lty=2, col="brown"); # 85% INFERIOR
abline(v=CuantilesA[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesA[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesA[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesA[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesA[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesA[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesA[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2   pEhEx - ADJUSTED (sample 3)', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[2,1], lty=2, col="darkblue");  # 70% INFERIOR
abline(v=CuantilesD[2,2], lty=2, col="darkblue"); # 70% SUPERIOR
abline(v=CuantilesD[3,1], lty=2, col="aquamarine4");  # 75% INFERIOR
abline(v=CuantilesD[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesD[5,1], lty=2, col="brown");  # 85% INFERIOR
abline(v=CuantilesD[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesD[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesD[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesD[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesD[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesD[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesD[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))

Grafica Cuantiles del \(65\%\) y \(80\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2  pEhEx - DATA (sample 2)', lty=9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2  BaseMean - ADJUSTED (sample 3)', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))

Grafica Cuantiles del \(70\%\) y \(85\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence, 
     main = 'Normalized Log2 pEhEx - DATA (sample 3)', lty=9)

abline(v=CuantilesA[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesA[2,2], lty=2, col="darkblue")
abline(v=CuantilesA[5,1], lty=2, col="brown"); 
abline(v=CuantilesA[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2  pEhEx - ADJUSTED (sample 3)', lty=9)

abline(v=CuantilesD[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesD[2,2], lty=2, col="darkblue")
abline(v=CuantilesD[5,1], lty=2, col="brown"); 
abline(v=CuantilesD[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))

Muestra pEhExvsCDC51

log2vsCDC51 <- data1$log2samplevsCDC51; head(mean(log2vsCDC51)); head(sd(log2vsCDC51))
## [1] 6.244372
## [1] 2.880412
head(log2vsCDC51,5)
## [1] 6.201533 6.807708 9.777801 8.946924 3.787731
ndata1    <- length(log2vsCDC51)
hist(log2vsCDC51, breaks = nbreaks, col= rainbow(25,0.3), 
     main = 'Log2vsCDC51')

meanlog2vsCDC51 <- mean(log2vsCDC51); head(meanlog2vsCDC51)
## [1] 6.244372
StdDevlog2vsCDC51 <- sd(log2vsCDC51); head(StdDevlog2vsCDC51)
## [1] 2.880412
Normlog2vsCDC51 <- (log2vsCDC51-meanlog2vsCDC51)/StdDevlog2vsCDC51; head(Normlog2vsCDC51)
## [1] -0.01487273  0.19557464  1.22670936  0.93825188 -0.85287855 -0.12253093
tst<- Normlog2vsCDC51

Primer histograma

hist(tst, breaks = nbreaks, col= 1:5, 
     main = 'Normalized Log2vsCDC51',
     xlab='pEhEx1',
     ylab= 'Frequency pEhEx')

Ajustando modelo

fw1<-fitdist(tst, "norm")
plotdist(tst, histo = TRUE, demp = TRUE)

nnorm.f <- fitdist(tst,"norm")
summary(nnorm.f)
## Fitting of the distribution ' norm ' by maximum likelihood 
## Parameters : 
##          estimate Std. Error
## mean 6.276949e-17 0.01447452
## sd   9.998952e-01 0.01023499
## Loglikelihood:  -6770.675   AIC:  13545.35   BIC:  13558.29 
## Correlation matrix:
##      mean sd
## mean    1  0
## sd      0  1
par(mfrow=c(2,2))
denscomp(nnorm.f,legendtext = 'Dist Normal')
qqcomp(nnorm.f,legendtext = 'Dist Normal')
cdfcomp(nnorm.f,legendtext = 'Dist Normal')
ppcomp(nnorm.f,legendtext = 'Dist Normal')

probs <- c();
probs[8] = 0.175;  probs[9] = 0.825; 
probs[7] = 0.15;   probs[10] = 0.85;   
probs[6] = 0.125;  probs[11] = 0.875; 
probs[5] = 0.1;    probs[12] = 0.9;    
probs[4] = 0.075;  probs[13] = 0.925; 
probs[3] = 0.05;   probs[14] = 0.95;   
probs[2] = 0.025;  probs[15] = 0.975; 
probs[1] = 0.005;  probs[16] = 0.995;  
CuantilesData <- quantile(tst,prob = probs)
CuantilesModel <- qnorm(probs, mean=0, sd=1)
Cuantilillos <- t(CuantilesModel)
colnames(Cuantilillos) <- c('0.5%','2.5%','5%','7.5%',
                            '10%','12.5%','15%','17.5%',
                            '82.5%','85%','87.5%','90%',
                            '92.5%','95%','97.5%','99.5%')
Cuantilillos <- t(Cuantilillos)
colnames(Cuantilillos) <- c('Cuantiles Ajuste')
print(Cuantilillos)
##       Cuantiles Ajuste
## 0.5%        -2.5758293
## 2.5%        -1.9599640
## 5%          -1.6448536
## 7.5%        -1.4395315
## 10%         -1.2815516
## 12.5%       -1.1503494
## 15%         -1.0364334
## 17.5%       -0.9345893
## 82.5%        0.9345893
## 85%          1.0364334
## 87.5%        1.1503494
## 90%          1.2815516
## 92.5%        1.4395315
## 95%          1.6448536
## 97.5%        1.9599640
## 99.5%        2.5758293
CuantilesA <- matrix(0,8,2)
CuantilesD <- matrix(0,8,2)
colnames(CuantilesA) <- c('LimInf','LimSup')
colnames(CuantilesD) <- c('LimInf','LimSup')
rownames(CuantilesA) <- c('65','70','75','80','85','90','95','99')
rownames(CuantilesD) <- c('65','70','75','80','85','90','95','99')
CuantilesA[1,1] <-CuantilesData[8]; CuantilesA[1,2] <-CuantilesData[9]
CuantilesA[2,1] <-CuantilesData[7]; CuantilesA[2,2] <-CuantilesData[10]
CuantilesA[3,1] <-CuantilesData[6]; CuantilesA[3,2] <-CuantilesData[11]
CuantilesA[4,1] <-CuantilesData[5]; CuantilesA[4,2] <-CuantilesData[12]
CuantilesA[5,1] <-CuantilesData[4]; CuantilesA[5,2] <-CuantilesData[13]
CuantilesA[6,1] <-CuantilesData[3]; CuantilesA[6,2] <-CuantilesData[14]
CuantilesA[7,1] <-CuantilesData[2]; CuantilesA[7,2] <-CuantilesData[15]
CuantilesA[8,1] <-CuantilesData[1]; CuantilesA[8,2] <-CuantilesData[16]
CuantilesD[1,1] <-Cuantilillos[8];  CuantilesD[1,2] <-Cuantilillos[9]
CuantilesD[2,1] <-Cuantilillos[7];  CuantilesD[2,2] <-Cuantilillos[10]
CuantilesD[3,1] <-Cuantilillos[6];  CuantilesD[3,2] <-Cuantilillos[11]
CuantilesD[4,1] <-Cuantilillos[5];  CuantilesD[4,2] <-Cuantilillos[12]
CuantilesD[5,1] <-Cuantilillos[4];  CuantilesD[5,2] <-Cuantilillos[13]
CuantilesD[6,1] <-Cuantilillos[3];  CuantilesD[6,2] <-Cuantilillos[14]
CuantilesD[7,1] <-Cuantilillos[2];  CuantilesD[7,2] <-Cuantilillos[15]
CuantilesD[8,1] <-Cuantilillos[1];  CuantilesD[8,2] <-Cuantilillos[16]
print(CuantilesD)
##        LimInf    LimSup
## 65 -0.9345893 0.9345893
## 70 -1.0364334 1.0364334
## 75 -1.1503494 1.1503494
## 80 -1.2815516 1.2815516
## 85 -1.4395315 1.4395315
## 90 -1.6448536 1.6448536
## 95 -1.9599640 1.9599640
## 99 -2.5758293 2.5758293
print(CuantilesA)
##        LimInf    LimSup
## 65 -0.8528786 0.8216616
## 70 -0.9073590 0.9496778
## 75 -0.9073590 1.1007491
## 80 -0.9684970 1.3308952
## 85 -1.0381490 1.6867728
## 90 -1.1190762 2.1306178
## 95 -1.2156475 2.6928135
## 99 -2.1678747 3.3316192

Histogramas

col_sequence <- rainbow(n = 7, alpha = 0.35, start = 0, end = 1)
par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC51 pEhEx - DATA', lty = 9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[2,1], lty=2, col="darkblue"); # 70% INFERIOR
abline(v=CuantilesA[2,2], lty=2, col="darkblue") # 70% SUPERIOR
abline(v=CuantilesA[3,1], lty=2, col="aquamarine4"); # 75% INFERIOR
abline(v=CuantilesA[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesA[5,1], lty=2, col="brown"); # 85% INFERIOR
abline(v=CuantilesA[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesA[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesA[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesA[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesA[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesA[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesA[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC51   pEhEx - ADJUSTED', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[2,1], lty=2, col="darkblue");  # 70% INFERIOR
abline(v=CuantilesD[2,2], lty=2, col="darkblue"); # 70% SUPERIOR
abline(v=CuantilesD[3,1], lty=2, col="aquamarine4");  # 75% INFERIOR
abline(v=CuantilesD[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesD[5,1], lty=2, col="brown");  # 85% INFERIOR
abline(v=CuantilesD[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesD[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesD[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesD[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesD[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesD[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesD[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))

Grafica Cuantiles del \(65\%\) y \(80\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC51  pEhEx - DATA', lty=9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC51  - ADJUSTED', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))

Grafica Cuantiles del \(70\%\) y \(85\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence, 
     main = 'Normalized Log2vsCDC51 pEhEx - DATA', lty=9)

abline(v=CuantilesA[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesA[2,2], lty=2, col="darkblue")
abline(v=CuantilesA[5,1], lty=2, col="brown"); 
abline(v=CuantilesA[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC51  pEhEx - ADJUSTED', lty=9)

abline(v=CuantilesD[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesD[2,2], lty=2, col="darkblue")
abline(v=CuantilesD[5,1], lty=2, col="brown"); 
abline(v=CuantilesD[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))

Muestra pEhExvsCDC52

log2vsCDC52 <- data1$log2samplevsCDC52; head(mean(log2vsCDC52)); head(sd(log2vsCDC52))
## [1] 6.269726
## [1] 2.952289
head(log2vsCDC52,5)
## [1] 5.392236 7.192281 9.556532 8.999192 6.765073

Primer Histograma

ndata1    <- length(log2vsCDC52)
hist(log2vsCDC52, breaks = nbreaks, col= rainbow(25,0.3), 
     main = 'Log2vsCDC52')

meanlog2vsCDC52 <- mean(log2vsCDC52); head(meanlog2vsCDC52)
## [1] 6.269726
StdDevlog2vsCDC52 <- sd(log2vsCDC52); head(StdDevlog2vsCDC52)
## [1] 2.952289
Normlog2vsCDC52 <- (log2vsCDC52-meanlog2vsCDC52)/StdDevlog2vsCDC52; head(Normlog2vsCDC52)
## [1] -0.2972235  0.3124880  1.1133080  0.9245256  0.1677843 -0.2837806
tst<- Normlog2vsCDC52

** Segundo Histograma**

hist(tst, breaks = nbreaks, col= 1:5, 
     main = 'Normalized Log2vsCDC52',
     xlab='pEhEx1',
     ylab= 'Frequency pEhEx')

Ajustando modelo

fw1<-fitdist(tst, "norm")
plotdist(tst, histo = TRUE, demp = TRUE)

nnorm.f <- fitdist(tst,"norm")
summary(nnorm.f)
## Fitting of the distribution ' norm ' by maximum likelihood 
## Parameters : 
##           estimate Std. Error
## mean -3.587454e-18 0.01447452
## sd    9.998952e-01 0.01023499
## Loglikelihood:  -6770.675   AIC:  13545.35   BIC:  13558.29 
## Correlation matrix:
##              mean           sd
## mean 1.000000e+00 1.684231e-11
## sd   1.684231e-11 1.000000e+00
par(mfrow=c(2,2))
denscomp(nnorm.f,legendtext = 'Dist Normal')
qqcomp(nnorm.f,legendtext = 'Dist Normal')
cdfcomp(nnorm.f,legendtext = 'Dist Normal')
ppcomp(nnorm.f,legendtext = 'Dist Normal')

Cálculo de cuantiles

probs <- c();
probs[8] = 0.175;  probs[9] = 0.825; 
probs[7] = 0.15;   probs[10] = 0.85;   
probs[6] = 0.125;  probs[11] = 0.875; 
probs[5] = 0.1;    probs[12] = 0.9;    
probs[4] = 0.075;  probs[13] = 0.925; 
probs[3] = 0.05;   probs[14] = 0.95;   
probs[2] = 0.025;  probs[15] = 0.975; 
probs[1] = 0.005;  probs[16] = 0.995;  
CuantilesData <- quantile(tst,prob = probs)
CuantilesModel <- qnorm(probs, mean=0, sd=1)
Cuantilillos <- t(CuantilesModel)
colnames(Cuantilillos) <- c('0.5%','2.5%','5%','7.5%',
                            '10%','12.5%','15%','17.5%',
                            '82.5%','85%','87.5%','90%',
                            '92.5%','95%','97.5%','99.5%')
Cuantilillos <- t(Cuantilillos)
colnames(Cuantilillos) <- c('Cuantiles Ajuste')
print(Cuantilillos)
##       Cuantiles Ajuste
## 0.5%        -2.5758293
## 2.5%        -1.9599640
## 5%          -1.6448536
## 7.5%        -1.4395315
## 10%         -1.2815516
## 12.5%       -1.1503494
## 15%         -1.0364334
## 17.5%       -0.9345893
## 82.5%        0.9345893
## 85%          1.0364334
## 87.5%        1.1503494
## 90%          1.2815516
## 92.5%        1.4395315
## 95%          1.6448536
## 97.5%        1.9599640
## 99.5%        2.5758293
CuantilesA <- matrix(0,8,2)
CuantilesD <- matrix(0,8,2)
colnames(CuantilesA) <- c('LimInf','LimSup')
colnames(CuantilesD) <- c('LimInf','LimSup')
rownames(CuantilesA) <- c('65','70','75','80','85','90','95','99')
rownames(CuantilesD) <- c('65','70','75','80','85','90','95','99')
CuantilesA[1,1] <-CuantilesData[8]; CuantilesA[1,2] <-CuantilesData[9]
CuantilesA[2,1] <-CuantilesData[7]; CuantilesA[2,2] <-CuantilesData[10]
CuantilesA[3,1] <-CuantilesData[6]; CuantilesA[3,2] <-CuantilesData[11]
CuantilesA[4,1] <-CuantilesData[5]; CuantilesA[4,2] <-CuantilesData[12]
CuantilesA[5,1] <-CuantilesData[4]; CuantilesA[5,2] <-CuantilesData[13]
CuantilesA[6,1] <-CuantilesData[3]; CuantilesA[6,2] <-CuantilesData[14]
CuantilesA[7,1] <-CuantilesData[2]; CuantilesA[7,2] <-CuantilesData[15]
CuantilesA[8,1] <-CuantilesData[1]; CuantilesA[8,2] <-CuantilesData[16]
CuantilesD[1,1] <-Cuantilillos[8];  CuantilesD[1,2] <-Cuantilillos[9]
CuantilesD[2,1] <-Cuantilillos[7];  CuantilesD[2,2] <-Cuantilillos[10]
CuantilesD[3,1] <-Cuantilillos[6];  CuantilesD[3,2] <-Cuantilillos[11]
CuantilesD[4,1] <-Cuantilillos[5];  CuantilesD[4,2] <-Cuantilillos[12]
CuantilesD[5,1] <-Cuantilillos[4];  CuantilesD[5,2] <-Cuantilillos[13]
CuantilesD[6,1] <-Cuantilillos[3];  CuantilesD[6,2] <-Cuantilillos[14]
CuantilesD[7,1] <-Cuantilillos[2];  CuantilesD[7,2] <-Cuantilillos[15]
CuantilesD[8,1] <-Cuantilillos[1];  CuantilesD[8,2] <-Cuantilillos[16]
print(CuantilesD)
##        LimInf    LimSup
## 65 -0.9345893 0.9345893
## 70 -1.0364334 1.0364334
## 75 -1.1503494 1.1503494
## 80 -1.2815516 1.2815516
## 85 -1.4395315 1.4395315
## 90 -1.6448536 1.6448536
## 95 -1.9599640 1.9599640
## 99 -2.5758293 2.5758293
print(CuantilesA)
##        LimInf    LimSup
## 65 -0.8380866 0.7932340
## 70 -0.8811551 0.9359679
## 75 -0.9283894 1.1117853
## 80 -1.0392501 1.3412158
## 85 -1.1058050 1.6629743
## 90 -1.1828753 2.0953140
## 95 -1.3871587 2.6382746
## 99 -2.1236833 3.2437321

Histogramas

col_sequence <- rainbow(n = 7, alpha = 0.35, start = 0, end = 1)
par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC52 pEhEx - DATA', lty = 9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[2,1], lty=2, col="darkblue"); # 70% INFERIOR
abline(v=CuantilesA[2,2], lty=2, col="darkblue") # 70% SUPERIOR
abline(v=CuantilesA[3,1], lty=2, col="aquamarine4"); # 75% INFERIOR
abline(v=CuantilesA[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesA[5,1], lty=2, col="brown"); # 85% INFERIOR
abline(v=CuantilesA[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesA[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesA[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesA[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesA[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesA[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesA[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC52   pEhEx - ADJUSTED', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[2,1], lty=2, col="darkblue");  # 70% INFERIOR
abline(v=CuantilesD[2,2], lty=2, col="darkblue"); # 70% SUPERIOR
abline(v=CuantilesD[3,1], lty=2, col="aquamarine4");  # 75% INFERIOR
abline(v=CuantilesD[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesD[5,1], lty=2, col="brown");  # 85% INFERIOR
abline(v=CuantilesD[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesD[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesD[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesD[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesD[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesD[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesD[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))

Grafica Cuantiles del \(65\%\) y \(80\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC52  pEhEx - DATA', lty=9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC52  - ADJUSTED', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))

Grafica Cuantiles del \(70\%\) y \(85\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence, 
     main = 'Normalized Log2vsCDC52 pEhEx - DATA', lty=9)

abline(v=CuantilesA[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesA[2,2], lty=2, col="darkblue")
abline(v=CuantilesA[5,1], lty=2, col="brown"); 
abline(v=CuantilesA[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC52  pEhEx - ADJUSTED', lty=9)

abline(v=CuantilesD[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesD[2,2], lty=2, col="darkblue")
abline(v=CuantilesD[5,1], lty=2, col="brown"); 
abline(v=CuantilesD[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))

Muestra pEhExvsCDC53

log2vsCDC53 <- data1$log2samplevsCDC53; head(mean(log2vsCDC53)); head(sd(log2vsCDC53))
## [1] 6.11433
## [1] 2.904448
head(log2vsCDC53,5)
## [1]  8.137224  9.332642 10.134283  7.867231  1.641542
ndata1    <- length(log2vsCDC53)

** Primer histograma**

hist(log2vsCDC53, breaks = nbreaks, col= rainbow(25,0.3), 
     main = 'Log2vsCDC53')

meanlog2vsCDC53 <- mean(log2vsCDC53); head(meanlog2vsCDC53)
## [1] 6.11433
StdDevlog2vsCDC53 <- sd(log2vsCDC53); head(StdDevlog2vsCDC53)
## [1] 2.904448
Normlog2vsCDC53 <- (log2vsCDC53-meanlog2vsCDC53)/StdDevlog2vsCDC53; head(Normlog2vsCDC53)
## [1]  0.6964814  1.1080632  1.3840678  0.6035230 -1.5399785  0.4537713
tst<- Normlog2vsCDC53

Segundo histograma

hist(tst, breaks = nbreaks, col= 1:5, 
     main = 'Normalized Log2vsCDC53',
     xlab='pEhEx1',
     ylab= 'Frequency pEhEx')

Ajustando modelo

fw1<-fitdist(tst, "norm")
plotdist(tst, histo = TRUE, demp = TRUE)

nnorm.f <- fitdist(tst,"norm")
summary(nnorm.f)
## Fitting of the distribution ' norm ' by maximum likelihood 
## Parameters : 
##           estimate Std. Error
## mean -9.490135e-17 0.01447452
## sd    9.998952e-01 0.01023499
## Loglikelihood:  -6770.675   AIC:  13545.35   BIC:  13558.29 
## Correlation matrix:
##      mean sd
## mean    1  0
## sd      0  1
par(mfrow=c(2,2))
denscomp(nnorm.f,legendtext = 'Dist Normal')
qqcomp(nnorm.f,legendtext = 'Dist Normal')
cdfcomp(nnorm.f,legendtext = 'Dist Normal')
ppcomp(nnorm.f,legendtext = 'Dist Normal')

Calculo de cuantiles

probs <- c();
probs[8] = 0.175;  probs[9] = 0.825; 
probs[7] = 0.15;   probs[10] = 0.85;   
probs[6] = 0.125;  probs[11] = 0.875; 
probs[5] = 0.1;    probs[12] = 0.9;    
probs[4] = 0.075;  probs[13] = 0.925; 
probs[3] = 0.05;   probs[14] = 0.95;   
probs[2] = 0.025;  probs[15] = 0.975; 
probs[1] = 0.005;  probs[16] = 0.995;  
CuantilesData <- quantile(tst,prob = probs)
CuantilesModel <- qnorm(probs, mean=0, sd=1)
Cuantilillos <- t(CuantilesModel)
colnames(Cuantilillos) <- c('0.5%','2.5%','5%','7.5%',
                            '10%','12.5%','15%','17.5%',
                            '82.5%','85%','87.5%','90%',
                            '92.5%','95%','97.5%','99.5%')
Cuantilillos <- t(Cuantilillos)
colnames(Cuantilillos) <- c('Cuantiles Ajuste')
print(Cuantilillos)
##       Cuantiles Ajuste
## 0.5%        -2.5758293
## 2.5%        -1.9599640
## 5%          -1.6448536
## 7.5%        -1.4395315
## 10%         -1.2815516
## 12.5%       -1.1503494
## 15%         -1.0364334
## 17.5%       -0.9345893
## 82.5%        0.9345893
## 85%          1.0364334
## 87.5%        1.1503494
## 90%          1.2815516
## 92.5%        1.4395315
## 95%          1.6448536
## 97.5%        1.9599640
## 99.5%        2.5758293
CuantilesA <- matrix(0,8,2)
CuantilesD <- matrix(0,8,2)
colnames(CuantilesA) <- c('LimInf','LimSup')
colnames(CuantilesD) <- c('LimInf','LimSup')
rownames(CuantilesA) <- c('65','70','75','80','85','90','95','99')
rownames(CuantilesD) <- c('65','70','75','80','85','90','95','99')
CuantilesA[1,1] <-CuantilesData[8]; CuantilesA[1,2] <-CuantilesData[9]
CuantilesA[2,1] <-CuantilesData[7]; CuantilesA[2,2] <-CuantilesData[10]
CuantilesA[3,1] <-CuantilesData[6]; CuantilesA[3,2] <-CuantilesData[11]
CuantilesA[4,1] <-CuantilesData[5]; CuantilesA[4,2] <-CuantilesData[12]
CuantilesA[5,1] <-CuantilesData[4]; CuantilesA[5,2] <-CuantilesData[13]
CuantilesA[6,1] <-CuantilesData[3]; CuantilesA[6,2] <-CuantilesData[14]
CuantilesA[7,1] <-CuantilesData[2]; CuantilesA[7,2] <-CuantilesData[15]
CuantilesA[8,1] <-CuantilesData[1]; CuantilesA[8,2] <-CuantilesData[16]
CuantilesD[1,1] <-Cuantilillos[8];  CuantilesD[1,2] <-Cuantilillos[9]
CuantilesD[2,1] <-Cuantilillos[7];  CuantilesD[2,2] <-Cuantilillos[10]
CuantilesD[3,1] <-Cuantilillos[6];  CuantilesD[3,2] <-Cuantilillos[11]
CuantilesD[4,1] <-Cuantilillos[5];  CuantilesD[4,2] <-Cuantilillos[12]
CuantilesD[5,1] <-Cuantilillos[4];  CuantilesD[5,2] <-Cuantilillos[13]
CuantilesD[6,1] <-Cuantilillos[3];  CuantilesD[6,2] <-Cuantilillos[14]
CuantilesD[7,1] <-Cuantilillos[2];  CuantilesD[7,2] <-Cuantilillos[15]
CuantilesD[8,1] <-Cuantilillos[1];  CuantilesD[8,2] <-Cuantilillos[16]
print(CuantilesD)
##        LimInf    LimSup
## 65 -0.9345893 0.9345893
## 70 -1.0364334 1.0364334
## 75 -1.1503494 1.1503494
## 80 -1.2815516 1.2815516
## 85 -1.4395315 1.4395315
## 90 -1.6448536 1.6448536
## 95 -1.9599640 1.9599640
## 99 -2.5758293 2.5758293
print(CuantilesA)
##        LimInf    LimSup
## 65 -0.8305939 0.8018512
## 70 -0.8877013 0.9412276
## 75 -0.9522378 1.1212912
## 80 -1.0264291 1.3220406
## 85 -1.1638210 1.5939827
## 90 -1.2824356 2.0684839
## 95 -1.4385679 2.6057307
## 99 -1.8396440 3.5572717

Histogramas

col_sequence <- rainbow(n = 7, alpha = 0.35, start = 0, end = 1)
par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC53 pEhEx - DATA', lty = 9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[2,1], lty=2, col="darkblue"); # 70% INFERIOR
abline(v=CuantilesA[2,2], lty=2, col="darkblue") # 70% SUPERIOR
abline(v=CuantilesA[3,1], lty=2, col="aquamarine4"); # 75% INFERIOR
abline(v=CuantilesA[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesA[5,1], lty=2, col="brown"); # 85% INFERIOR
abline(v=CuantilesA[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesA[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesA[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesA[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesA[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesA[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesA[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC53   pEhEx - ADJUSTED', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[2,1], lty=2, col="darkblue");  # 70% INFERIOR
abline(v=CuantilesD[2,2], lty=2, col="darkblue"); # 70% SUPERIOR
abline(v=CuantilesD[3,1], lty=2, col="aquamarine4");  # 75% INFERIOR
abline(v=CuantilesD[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesD[5,1], lty=2, col="brown");  # 85% INFERIOR
abline(v=CuantilesD[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesD[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesD[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesD[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesD[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesD[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesD[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))

Grafica Cuantiles del \(65\%\) y \(80\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC53  pEhEx - DATA', lty=9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC51  - ADJUSTED', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))

Grafica Cuantiles del \(70\%\) y \(85\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence, 
     main = 'Normalized Log2vsCDC53 pEhEx - DATA', lty=9)

abline(v=CuantilesA[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesA[2,2], lty=2, col="darkblue")
abline(v=CuantilesA[5,1], lty=2, col="brown"); 
abline(v=CuantilesA[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC53  pEhEx - ADJUSTED', lty=9)

abline(v=CuantilesD[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesD[2,2], lty=2, col="darkblue")
abline(v=CuantilesD[5,1], lty=2, col="brown"); 
abline(v=CuantilesD[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))

Segunda Clasificacion: pEhExvsCmasM

head(pEhExvsCmasM,10);
## # A tibble: 10 × 7
##    GenId       CDC5_1 CDC5_2 CDC5_3 pEhEx_1 pEhEx_2 pEhEx_3
##    <chr>        <dbl>  <dbl>  <dbl>   <dbl>   <dbl>   <dbl>
##  1 EHI_000130A   45.3  108.   129.    180.    446.    516. 
##  2 EHI_000140A   66.0  318.   257.    363.    352.     41.8
##  3 EHI_000240A  701.  1282.   877.   1209.   1993.   2290. 
##  4 EHI_000250A  707.   430.   389.    334.    337.    711. 
##  5 EHI_000260A   94.5  109.    35.2   112.     69.1    54.2
##  6 EHI_000280A   58.3   50.5   80.8    56.5    86.1    66.6
##  7 EHI_000290A   27.2   14.9   23.9    19.1    14.5    87.6
##  8 EHI_000300A   60.9  143.   111.    137.    119.     34.1
##  9 EHI_000410A   15.5   21.8   23.2    29.0    25.5    70.5
## 10 EHI_000430A   27.2   27.5   22.4    26.7    14.5    11.6
nbreaks <- 10
data2 <- pEhExvsCmasM;       head(data2)
## # A tibble: 6 × 7
##   GenId       CDC5_1 CDC5_2 CDC5_3 pEhEx_1 pEhEx_2 pEhEx_3
##   <chr>        <dbl>  <dbl>  <dbl>   <dbl>   <dbl>   <dbl>
## 1 EHI_000130A   45.3  108.   129.    180.    446.    516. 
## 2 EHI_000140A   66.0  318.   257.    363.    352.     41.8
## 3 EHI_000240A  701.  1282.   877.   1209.   1993.   2290. 
## 4 EHI_000250A  707.   430.   389.    334.    337.    711. 
## 5 EHI_000260A   94.5  109.    35.2   112.     69.1    54.2
## 6 EHI_000280A   58.3   50.5   80.8    56.5    86.1    66.6

Log-Normalización

sample1   <- data2$pEhEx_1; sample2   <- data2$pEhEx_2; sample3   <- data2$pEhEx_3;
samplevs1 <- data2$CDC5_1;  samplevs2 <- data2$CDC5_2;  samplevs3 <- data2$CDC5_3;
log2sample1 <- log2(sample1+1);         log2sample2 <- log2(sample2+1)
log2sample3 <- log2(sample3+1);         log2samplevsCDC51 <- log2(samplevs1+1)
log2samplevsCDC52 <- log2(samplevs2+1); log2samplevsCDC53 <- log2(samplevs3+1)
data2 <- cbind(data2, log2sample1,log2sample2,log2sample3,
               log2samplevsCDC51,log2samplevsCDC52,log2samplevsCDC53)
head(data2)
##         GenId    CDC5_1     CDC5_2    CDC5_3    pEhEx_1    pEhEx_2    pEhEx_3
## 1 EHI_000130A  45.32378  107.82734 128.66351  180.07428  446.15729  516.14317
## 2 EHI_000140A  66.04322  317.74653 257.32703  363.20067  351.59134   41.84945
## 3 EHI_000240A 700.57610 1282.45711 877.45524 1208.63415 1993.15918 2290.09468
## 4 EHI_000250A 707.05093  430.16227 388.98271  334.20566  337.04273  710.66559
## 5 EHI_000260A  94.53245  108.97444  35.15805  112.16491   69.10588   54.24928
## 6 EHI_000280A  58.27343   50.47237  80.78872   56.46397   86.07926   66.64912
##   log2sample1 log2sample2 log2sample3 log2samplevsCDC51 log2samplevsCDC52
## 1    7.500438    8.804639    9.014420          5.533681          6.765897
## 2    8.508590    8.461853    5.421205          6.067020          8.316266
## 3   10.240355   10.961565   11.161821          9.454456         10.325819
## 4    8.388903    8.401062    9.475056          9.467709          8.752087
## 5    6.822283    6.131464    5.787884          6.577919          6.781024
## 6    5.844586    6.444257    6.079999          5.889314          5.685726
##   log2samplevsCDC53
## 1          7.018629
## 2          8.013055
## 3          9.778825
## 4          8.607266
## 5          5.176245
## 6          6.353830
save.image('CheckPointThree.RData')
setwd("~/Documents/GitHub/Resultados/docs/PrimeroDiffExpAllResults/Clasificando/Abundances")
#load('CheckPointTwo.RData')
library(ggplot2);library(dplyr);library("fitdistrplus");
library("MASS");library("survival")
head(data2)
##         GenId    CDC5_1     CDC5_2    CDC5_3    pEhEx_1    pEhEx_2    pEhEx_3
## 1 EHI_000130A  45.32378  107.82734 128.66351  180.07428  446.15729  516.14317
## 2 EHI_000140A  66.04322  317.74653 257.32703  363.20067  351.59134   41.84945
## 3 EHI_000240A 700.57610 1282.45711 877.45524 1208.63415 1993.15918 2290.09468
## 4 EHI_000250A 707.05093  430.16227 388.98271  334.20566  337.04273  710.66559
## 5 EHI_000260A  94.53245  108.97444  35.15805  112.16491   69.10588   54.24928
## 6 EHI_000280A  58.27343   50.47237  80.78872   56.46397   86.07926   66.64912
##   log2sample1 log2sample2 log2sample3 log2samplevsCDC51 log2samplevsCDC52
## 1    7.500438    8.804639    9.014420          5.533681          6.765897
## 2    8.508590    8.461853    5.421205          6.067020          8.316266
## 3   10.240355   10.961565   11.161821          9.454456         10.325819
## 4    8.388903    8.401062    9.475056          9.467709          8.752087
## 5    6.822283    6.131464    5.787884          6.577919          6.781024
## 6    5.844586    6.444257    6.079999          5.889314          5.685726
##   log2samplevsCDC53
## 1          7.018629
## 2          8.013055
## 3          9.778825
## 4          8.607266
## 5          5.176245
## 6          6.353830

Muestra 1

log2sample1 <- data2$log2sample1; head(mean(log2sample1)); head(sd(log2sample1))
## [1] 6.460339
## [1] 2.834041
head(log2sample1,5)
## [1]  7.500438  8.508590 10.240355  8.388903  6.822283
summary(data2)
##     GenId               CDC5_1             CDC5_2              CDC5_3        
##  Length:4691        Min.   :     0.0   Min.   :     0.00   Min.   :     0.0  
##  Class :character   1st Qu.:    19.4   1st Qu.:    19.50   1st Qu.:    20.9  
##  Mode  :character   Median :    50.5   Median :    56.21   Median :    54.6  
##                     Mean   :  1930.9   Mean   :  1790.28   Mean   :  2024.1  
##                     3rd Qu.:   209.8   3rd Qu.:   248.92   3rd Qu.:   223.3  
##                     Max.   :405707.4   Max.   :282737.06   Max.   :384267.8  
##     pEhEx_1             pEhEx_2             pEhEx_3          log2sample1    
##  Min.   :     0.00   Min.   :     0.00   Min.   :     0.0   Min.   : 0.000  
##  1st Qu.:    19.84   1st Qu.:    18.19   1st Qu.:    17.0   1st Qu.: 4.381  
##  Median :    55.70   Median :    56.98   Median :    60.4   Median : 5.825  
##  Mean   :  1503.81   Mean   :  1895.10   Mean   :  2146.4   Mean   : 6.460  
##  3rd Qu.:   227.38   3rd Qu.:   250.96   3rd Qu.:   272.4   3rd Qu.: 7.835  
##  Max.   :219640.26   Max.   :288237.01   Max.   :781911.9   Max.   :17.745  
##   log2sample2      log2sample3     log2samplevsCDC51 log2samplevsCDC52
##  Min.   : 0.000   Min.   : 0.000   Min.   : 0.000    Min.   : 0.000   
##  1st Qu.: 4.262   1st Qu.: 4.174   1st Qu.: 4.352    1st Qu.: 4.358   
##  Median : 5.858   Median : 5.941   Median : 5.687    Median : 5.838   
##  Mean   : 6.424   Mean   : 6.345   Mean   : 6.361    Mean   : 6.456   
##  3rd Qu.: 7.977   3rd Qu.: 8.095   3rd Qu.: 7.720    3rd Qu.: 7.965   
##  Max.   :18.137   Max.   :19.577   Max.   :18.630    Max.   :18.109   
##  log2samplevsCDC53
##  Min.   : 0.000   
##  1st Qu.: 4.456   
##  Median : 5.797   
##  Mean   : 6.531   
##  3rd Qu.: 7.809   
##  Max.   :18.552
ndata2    <- length(log2sample1)
hist(log2sample1, breaks = nbreaks, col= rainbow(25,0.3), 
     main = 'Log2 sample1')

meanlog2sample1 <- mean(log2sample1); head(meanlog2sample1)
## [1] 6.460339
StdDevlog2sample1 <- sd(log2sample1); head(StdDevlog2sample1)
## [1] 2.834041
Normlog2sample1 <- (log2sample1-meanlog2sample1)/StdDevlog2sample1; head(Normlog2sample1)
## [1]  0.3670021  0.7227316  1.3337904  0.6804997  0.1277131 -0.2172704
tst<- Normlog2sample1

hist(tst, breaks = nbreaks, col= 1:5, 
     main = 'Normalized Log2sample1',
     xlab='pEhEx1',
     ylab= 'Frequency pEhEx')

fw1<-fitdist(tst, "norm")
plotdist(tst, histo = TRUE, demp = TRUE)

nnorm.f <- fitdist(tst,"norm")
summary(nnorm.f)
## Fitting of the distribution ' norm ' by maximum likelihood 
## Parameters : 
##          estimate Std. Error
## mean 3.118970e-17 0.01459893
## sd   9.998934e-01 0.01032296
## Loglikelihood:  -6655.741   AIC:  13315.48   BIC:  13328.39 
## Correlation matrix:
##      mean sd
## mean    1  0
## sd      0  1
par(mfrow=c(2,2))
denscomp(nnorm.f,legendtext = 'Dist Normal')
qqcomp(nnorm.f,legendtext = 'Dist Normal')
cdfcomp(nnorm.f,legendtext = 'Dist Normal')
ppcomp(nnorm.f,legendtext = 'Dist Normal')

probs <- c();
probs[8] = 0.175;  probs[9] = 0.825; 
probs[7] = 0.15;   probs[10] = 0.85;   
probs[6] = 0.125;  probs[11] = 0.875; 
probs[5] = 0.1;    probs[12] = 0.9;    
probs[4] = 0.075;  probs[13] = 0.925; 
probs[3] = 0.05;   probs[14] = 0.95;   
probs[2] = 0.025;  probs[15] = 0.975; 
probs[1] = 0.005;  probs[16] = 0.995;  
CuantilesData <- quantile(tst,prob = probs)
CuantilesModel <- qnorm(probs, mean=0, sd=1)
Cuantilillos <- t(CuantilesModel)
colnames(Cuantilillos) <- c('0.5%','2.5%','5%','7.5%',
                            '10%','12.5%','15%','17.5%',
                            '82.5%','85%','87.5%','90%',
                            '92.5%','95%','97.5%','99.5%')
Cuantilillos <- t(Cuantilillos)
colnames(Cuantilillos) <- c('Cuantiles Ajuste')
print(Cuantilillos)
##       Cuantiles Ajuste
## 0.5%        -2.5758293
## 2.5%        -1.9599640
## 5%          -1.6448536
## 7.5%        -1.4395315
## 10%         -1.2815516
## 12.5%       -1.1503494
## 15%         -1.0364334
## 17.5%       -0.9345893
## 82.5%        0.9345893
## 85%          1.0364334
## 87.5%        1.1503494
## 90%          1.2815516
## 92.5%        1.4395315
## 95%          1.6448536
## 97.5%        1.9599640
## 99.5%        2.5758293

Cálculo de cuantiles

CuantilesA <- matrix(0,8,2)
CuantilesD <- matrix(0,8,2)
colnames(CuantilesA) <- c('LimInf','LimSup')
colnames(CuantilesD) <- c('LimInf','LimSup')
rownames(CuantilesA) <- c('65','70','75','80','85','90','95','99')
rownames(CuantilesD) <- c('65','70','75','80','85','90','95','99')
CuantilesA[1,1] <-CuantilesData[8]; CuantilesA[1,2] <-CuantilesData[9]
CuantilesA[2,1] <-CuantilesData[7]; CuantilesA[2,2] <-CuantilesData[10]
CuantilesA[3,1] <-CuantilesData[6]; CuantilesA[3,2] <-CuantilesData[11]
CuantilesA[4,1] <-CuantilesData[5]; CuantilesA[4,2] <-CuantilesData[12]
CuantilesA[5,1] <-CuantilesData[4]; CuantilesA[5,2] <-CuantilesData[13]
CuantilesA[6,1] <-CuantilesData[3]; CuantilesA[6,2] <-CuantilesData[14]
CuantilesA[7,1] <-CuantilesData[2]; CuantilesA[7,2] <-CuantilesData[15]
CuantilesA[8,1] <-CuantilesData[1]; CuantilesA[8,2] <-CuantilesData[16]
CuantilesD[1,1] <-Cuantilillos[8];  CuantilesD[1,2] <-Cuantilillos[9]
CuantilesD[2,1] <-Cuantilillos[7];  CuantilesD[2,2] <-Cuantilillos[10]
CuantilesD[3,1] <-Cuantilillos[6];  CuantilesD[3,2] <-Cuantilillos[11]
CuantilesD[4,1] <-Cuantilillos[5];  CuantilesD[4,2] <-Cuantilillos[12]
CuantilesD[5,1] <-Cuantilillos[4];  CuantilesD[5,2] <-Cuantilillos[13]
CuantilesD[6,1] <-Cuantilillos[3];  CuantilesD[6,2] <-Cuantilillos[14]
CuantilesD[7,1] <-Cuantilillos[2];  CuantilesD[7,2] <-Cuantilillos[15]
CuantilesD[8,1] <-Cuantilillos[1];  CuantilesD[8,2] <-Cuantilillos[16]
print(CuantilesD)
##        LimInf    LimSup
## 65 -0.9345893 0.9345893
## 70 -1.0364334 1.0364334
## 75 -1.1503494 1.1503494
## 80 -1.2815516 1.2815516
## 85 -1.4395315 1.4395315
## 90 -1.6448536 1.6448536
## 95 -1.9599640 1.9599640
## 99 -2.5758293 2.5758293
print(CuantilesA)
##        LimInf    LimSup
## 65 -0.8599158 0.8169091
## 70 -0.9371527 0.9617338
## 75 -0.9960331 1.1293972
## 80 -1.0282412 1.3839029
## 85 -1.0995019 1.7041875
## 90 -1.1392596 2.1899810
## 95 -1.2814439 2.6187913
## 99 -1.6734604 3.1869302
col_sequence <- rainbow(n = 7, alpha = 0.35, start = 0, end = 1)
par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2 pEhEx - DATA', lty = 9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[2,1], lty=2, col="darkblue"); # 70% INFERIOR
abline(v=CuantilesA[2,2], lty=2, col="darkblue") # 70% SUPERIOR
abline(v=CuantilesA[3,1], lty=2, col="aquamarine4"); # 75% INFERIOR
abline(v=CuantilesA[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesA[5,1], lty=2, col="brown"); # 85% INFERIOR
abline(v=CuantilesA[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesA[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesA[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesA[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesA[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesA[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesA[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2   pEhEx - ADJUSTED', lty=9)
abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[2,1], lty=2, col="darkblue");  # 70% INFERIOR
abline(v=CuantilesD[2,2], lty=2, col="darkblue"); # 70% SUPERIOR
abline(v=CuantilesD[3,1], lty=2, col="aquamarine4");  # 75% INFERIOR
abline(v=CuantilesD[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesD[5,1], lty=2, col="brown");  # 85% INFERIOR
abline(v=CuantilesD[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesD[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesD[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesD[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesD[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesD[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesD[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))

Grafica Cuantiles del \(65\%\) y \(80\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2  pEhEx - DATA', lty=9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2  BaseMean - ADJUSTED', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))

Grafica Cuantiles del \(70\%\) y \(85\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence, 
     main = 'Normalized Log2 pEhEx - DATA', lty=9)

abline(v=CuantilesA[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesA[2,2], lty=2, col="darkblue")
abline(v=CuantilesA[5,1], lty=2, col="brown"); 
abline(v=CuantilesA[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2  pEhEx - ADJUSTED', lty=9)

abline(v=CuantilesD[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesD[2,2], lty=2, col="darkblue")
abline(v=CuantilesD[5,1], lty=2, col="brown"); 
abline(v=CuantilesD[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))

Muestra 2

log2sample2 <- data2$log2sample2; head(mean(log2sample2)); head(sd(log2sample2))
## [1] 6.424318
## [1] 3.078114
head(log2sample2,5)
## [1]  8.804639  8.461853 10.961565  8.401062  6.131464
ndata2    <- length(log2sample2)
hist(log2sample2, breaks = nbreaks, col= rainbow(25,0.3), 
     main = 'Log2 sample2')

Log-normalizacion

meanlog2sample2 <- mean(log2sample2); head(meanlog2sample2)
## [1] 6.424318
StdDevlog2sample2 <- sd(log2sample2); head(StdDevlog2sample2)
## [1] 3.078114
Normlog2sample2 <- (log2sample2-meanlog2sample2)/StdDevlog2sample2; head(Normlog2sample2)
## [1]  0.773304903  0.661942766  1.474034750  0.642193202 -0.095140848
## [6]  0.006477743
tst<- Normlog2sample2
hist(tst, breaks = nbreaks, col= 1:5, 
     main = 'Normalized Log2sample1',
     xlab='pEhEx1',
     ylab= 'Frequency pEhEx')

Ajuste de modelo

fw1<-fitdist(tst, "norm")
plotdist(tst, histo = TRUE, demp = TRUE)

nnorm.f <- fitdist(tst,"norm")
summary(nnorm.f)
## Fitting of the distribution ' norm ' by maximum likelihood 
## Parameters : 
##           estimate Std. Error
## mean -7.845328e-17 0.01459893
## sd    9.998934e-01 0.01032296
## Loglikelihood:  -6655.741   AIC:  13315.48   BIC:  13328.39 
## Correlation matrix:
##      mean sd
## mean    1  0
## sd      0  1
par(mfrow=c(2,2))
denscomp(nnorm.f,legendtext = 'Dist Normal')
qqcomp(nnorm.f,legendtext = 'Dist Normal')
cdfcomp(nnorm.f,legendtext = 'Dist Normal')
ppcomp(nnorm.f,legendtext = 'Dist Normal')

probs <- c();
probs[8] = 0.175;  probs[9] = 0.825; 
probs[7] = 0.15;   probs[10] = 0.85;   
probs[6] = 0.125;  probs[11] = 0.875; 
probs[5] = 0.1;    probs[12] = 0.9;    
probs[4] = 0.075;  probs[13] = 0.925; 
probs[3] = 0.05;   probs[14] = 0.95;   
probs[2] = 0.025;  probs[15] = 0.975; 
probs[1] = 0.005;  probs[16] = 0.995;  
CuantilesData <- quantile(tst,prob = probs)
CuantilesModel <- qnorm(probs, mean=0, sd=1)
Cuantilillos <- t(CuantilesModel)
colnames(Cuantilillos) <- c('0.5%','2.5%','5%','7.5%',
                            '10%','12.5%','15%','17.5%',
                            '82.5%','85%','87.5%','90%',
                            '92.5%','95%','97.5%','99.5%')
Cuantilillos <- t(Cuantilillos)
colnames(Cuantilillos) <- c('Cuantiles Ajuste')
print(Cuantilillos)
##       Cuantiles Ajuste
## 0.5%        -2.5758293
## 2.5%        -1.9599640
## 5%          -1.6448536
## 7.5%        -1.4395315
## 10%         -1.2815516
## 12.5%       -1.1503494
## 15%         -1.0364334
## 17.5%       -0.9345893
## 82.5%        0.9345893
## 85%          1.0364334
## 87.5%        1.1503494
## 90%          1.2815516
## 92.5%        1.4395315
## 95%          1.6448536
## 97.5%        1.9599640
## 99.5%        2.5758293
CuantilesA <- matrix(0,8,2)
CuantilesD <- matrix(0,8,2)
colnames(CuantilesA) <- c('LimInf','LimSup')
colnames(CuantilesD) <- c('LimInf','LimSup')
rownames(CuantilesA) <- c('65','70','75','80','85','90','95','99')
rownames(CuantilesD) <- c('65','70','75','80','85','90','95','99')
CuantilesA[1,1] <-CuantilesData[8]; CuantilesA[1,2] <-CuantilesData[9]
CuantilesA[2,1] <-CuantilesData[7]; CuantilesA[2,2] <-CuantilesData[10]
CuantilesA[3,1] <-CuantilesData[6]; CuantilesA[3,2] <-CuantilesData[11]
CuantilesA[4,1] <-CuantilesData[5]; CuantilesA[4,2] <-CuantilesData[12]
CuantilesA[5,1] <-CuantilesData[4]; CuantilesA[5,2] <-CuantilesData[13]
CuantilesA[6,1] <-CuantilesData[3]; CuantilesA[6,2] <-CuantilesData[14]
CuantilesA[7,1] <-CuantilesData[2]; CuantilesA[7,2] <-CuantilesData[15]
CuantilesA[8,1] <-CuantilesData[1]; CuantilesA[8,2] <-CuantilesData[16]
CuantilesD[1,1] <-Cuantilillos[8];  CuantilesD[1,2] <-Cuantilillos[9]
CuantilesD[2,1] <-Cuantilillos[7];  CuantilesD[2,2] <-Cuantilillos[10]
CuantilesD[3,1] <-Cuantilillos[6];  CuantilesD[3,2] <-Cuantilillos[11]
CuantilesD[4,1] <-Cuantilillos[5];  CuantilesD[4,2] <-Cuantilillos[12]
CuantilesD[5,1] <-Cuantilillos[4];  CuantilesD[5,2] <-Cuantilillos[13]
CuantilesD[6,1] <-Cuantilillos[3];  CuantilesD[6,2] <-Cuantilillos[14]
CuantilesD[7,1] <-Cuantilillos[2];  CuantilesD[7,2] <-Cuantilillos[15]
CuantilesD[8,1] <-Cuantilillos[1];  CuantilesD[8,2] <-Cuantilillos[16]

print(CuantilesD)
##        LimInf    LimSup
## 65 -0.9345893 0.9345893
## 70 -1.0364334 1.0364334
## 75 -1.1503494 1.1503494
## 80 -1.2815516 1.2815516
## 85 -1.4395315 1.4395315
## 90 -1.6448536 1.6448536
## 95 -1.9599640 1.9599640
## 99 -2.5758293 2.5758293
print(CuantilesA)
##        LimInf    LimSup
## 65 -0.8804743 0.8477586
## 70 -0.9259047 0.9845324
## 75 -0.9762161 1.1416416
## 80 -1.0325848 1.3729846
## 85 -1.1709305 1.7147626
## 90 -1.2592113 2.1352442
## 95 -1.5101169 2.5267006
## 99 -2.0870956 3.0982665
col_sequence <- rainbow(n = 7, alpha = 0.35, start = 0, end = 1)
par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2 pEhEx - DATA (sample 2)', lty = 9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[2,1], lty=2, col="darkblue"); # 70% INFERIOR
abline(v=CuantilesA[2,2], lty=2, col="darkblue") # 70% SUPERIOR
abline(v=CuantilesA[3,1], lty=2, col="aquamarine4"); # 75% INFERIOR
abline(v=CuantilesA[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesA[5,1], lty=2, col="brown"); # 85% INFERIOR
abline(v=CuantilesA[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesA[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesA[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesA[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesA[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesA[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesA[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2   pEhEx - ADJUSTED (sample 2)', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[2,1], lty=2, col="darkblue");  # 70% INFERIOR
abline(v=CuantilesD[2,2], lty=2, col="darkblue"); # 70% SUPERIOR
abline(v=CuantilesD[3,1], lty=2, col="aquamarine4");  # 75% INFERIOR
abline(v=CuantilesD[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesD[5,1], lty=2, col="brown");  # 85% INFERIOR
abline(v=CuantilesD[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesD[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesD[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesD[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesD[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesD[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesD[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))

Grafica Cuantiles del \(65\%\) y \(80\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2  pEhEx - DATA (sample 2)', lty=9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2  BaseMean - ADJUSTED (sample 2)', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))

Grafica Cuantiles del \(70\%\) y \(85\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence, 
     main = 'Normalized Log2 pEhEx - DATA (sample 2)', lty=9)

abline(v=CuantilesA[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesA[2,2], lty=2, col="darkblue")
abline(v=CuantilesA[5,1], lty=2, col="brown"); 
abline(v=CuantilesA[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2  pEhEx - ADJUSTED (sample 2)', lty=9)

abline(v=CuantilesD[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesD[2,2], lty=2, col="darkblue")
abline(v=CuantilesD[5,1], lty=2, col="brown"); 
abline(v=CuantilesD[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))

Muestra 3

log2sample3 <- data2$log2sample3; head(mean(log2sample3)); head(sd(log2sample3))
## [1] 6.345251
## [1] 3.202711
head(log2sample3,5)
## [1]  9.014420  5.421205 11.161821  9.475056  5.787884
ndata2    <- length(log2sample3)
hist(log2sample3, breaks = nbreaks, col= rainbow(25,0.3), 
     main = 'Log2 sample2')

meanlog2sample3 <- mean(log2sample3); head(meanlog2sample3)
## [1] 6.345251
StdDevlog2sample3 <- sd(log2sample3); head(StdDevlog2sample3)
## [1] 3.202711
Normlog2sample3 <- (log2sample3-meanlog2sample3)/StdDevlog2sample3; head(Normlog2sample3)
## [1]  0.83340927 -0.28851998  1.50390416  0.97723608 -0.17402974 -0.08282095
tst<- Normlog2sample3
hist(tst, breaks = nbreaks, col= 1:5, 
     main = 'Normalized Log2sample1',
     xlab='pEhEx1',
     ylab= 'Frequency pEhEx')

Ajustando Modelos

fw1<-fitdist(tst, "norm")
plotdist(tst, histo = TRUE, demp = TRUE)

nnorm.f <- fitdist(tst,"norm")
summary(nnorm.f)
## Fitting of the distribution ' norm ' by maximum likelihood 
## Parameters : 
##          estimate Std. Error
## mean 2.404120e-17 0.01459893
## sd   9.998934e-01 0.01032296
## Loglikelihood:  -6655.741   AIC:  13315.48   BIC:  13328.39 
## Correlation matrix:
##              mean           sd
## mean 1.000000e+00 1.713307e-11
## sd   1.713307e-11 1.000000e+00
par(mfrow=c(2,2))
denscomp(nnorm.f,legendtext = 'Dist Normal')
qqcomp(nnorm.f,legendtext = 'Dist Normal')
cdfcomp(nnorm.f,legendtext = 'Dist Normal')
ppcomp(nnorm.f,legendtext = 'Dist Normal')

probs <- c();
probs[8] = 0.175;  probs[9] = 0.825; 
probs[7] = 0.15;   probs[10] = 0.85;   
probs[6] = 0.125;  probs[11] = 0.875; 
probs[5] = 0.1;    probs[12] = 0.9;    
probs[4] = 0.075;  probs[13] = 0.925; 
probs[3] = 0.05;   probs[14] = 0.95;   
probs[2] = 0.025;  probs[15] = 0.975; 
probs[1] = 0.005;  probs[16] = 0.995;  
CuantilesData <- quantile(tst,prob = probs)
CuantilesModel <- qnorm(probs, mean=0, sd=1)
Cuantilillos <- t(CuantilesModel)
colnames(Cuantilillos) <- c('0.5%','2.5%','5%','7.5%',
                            '10%','12.5%','15%','17.5%',
                            '82.5%','85%','87.5%','90%',
                            '92.5%','95%','97.5%','99.5%')
Cuantilillos <- t(Cuantilillos)
colnames(Cuantilillos) <- c('Cuantiles Ajuste')
print(Cuantilillos)
##       Cuantiles Ajuste
## 0.5%        -2.5758293
## 2.5%        -1.9599640
## 5%          -1.6448536
## 7.5%        -1.4395315
## 10%         -1.2815516
## 12.5%       -1.1503494
## 15%         -1.0364334
## 17.5%       -0.9345893
## 82.5%        0.9345893
## 85%          1.0364334
## 87.5%        1.1503494
## 90%          1.2815516
## 92.5%        1.4395315
## 95%          1.6448536
## 97.5%        1.9599640
## 99.5%        2.5758293
CuantilesA <- matrix(0,8,2)
CuantilesD <- matrix(0,8,2)
colnames(CuantilesA) <- c('LimInf','LimSup')
colnames(CuantilesD) <- c('LimInf','LimSup')
rownames(CuantilesA) <- c('65','70','75','80','85','90','95','99')
rownames(CuantilesD) <- c('65','70','75','80','85','90','95','99')
CuantilesA[1,1] <-CuantilesData[8]; CuantilesA[1,2] <-CuantilesData[9]
CuantilesA[2,1] <-CuantilesData[7]; CuantilesA[2,2] <-CuantilesData[10]
CuantilesA[3,1] <-CuantilesData[6]; CuantilesA[3,2] <-CuantilesData[11]
CuantilesA[4,1] <-CuantilesData[5]; CuantilesA[4,2] <-CuantilesData[12]
CuantilesA[5,1] <-CuantilesData[4]; CuantilesA[5,2] <-CuantilesData[13]
CuantilesA[6,1] <-CuantilesData[3]; CuantilesA[6,2] <-CuantilesData[14]
CuantilesA[7,1] <-CuantilesData[2]; CuantilesA[7,2] <-CuantilesData[15]
CuantilesA[8,1] <-CuantilesData[1]; CuantilesA[8,2] <-CuantilesData[16]
CuantilesD[1,1] <-Cuantilillos[8];  CuantilesD[1,2] <-Cuantilillos[9]
CuantilesD[2,1] <-Cuantilillos[7];  CuantilesD[2,2] <-Cuantilillos[10]
CuantilesD[3,1] <-Cuantilillos[6];  CuantilesD[3,2] <-Cuantilillos[11]
CuantilesD[4,1] <-Cuantilillos[5];  CuantilesD[4,2] <-Cuantilillos[12]
CuantilesD[5,1] <-Cuantilillos[4];  CuantilesD[5,2] <-Cuantilillos[13]
CuantilesD[6,1] <-Cuantilillos[3];  CuantilesD[6,2] <-Cuantilillos[14]
CuantilesD[7,1] <-Cuantilillos[2];  CuantilesD[7,2] <-Cuantilillos[15]
CuantilesD[8,1] <-Cuantilillos[1];  CuantilesD[8,2] <-Cuantilillos[16]
print(CuantilesD)
##        LimInf    LimSup
## 65 -0.9345893 0.9345893
## 70 -1.0364334 1.0364334
## 75 -1.1503494 1.1503494
## 80 -1.2815516 1.2815516
## 85 -1.4395315 1.4395315
## 90 -1.6448536 1.6448536
## 95 -1.9599640 1.9599640
## 99 -2.5758293 2.5758293
print(CuantilesA)
##        LimInf    LimSup
## 65 -0.8675316 0.8402759
## 70 -0.9659157 0.9685687
## 75 -1.0459211 1.1104543
## 80 -1.1432722 1.3204414
## 85 -1.2676335 1.6079001
## 90 -1.4400018 1.9997962
## 95 -1.7227405 2.4584046
## 99 -1.9812123 3.0490511

Creación de histogramas

col_sequence <- rainbow(n = 7, alpha = 0.35, start = 0, end = 1)
par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2 pEhEx - DATA (sample 3)', lty = 9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[2,1], lty=2, col="darkblue"); # 70% INFERIOR
abline(v=CuantilesA[2,2], lty=2, col="darkblue") # 70% SUPERIOR
abline(v=CuantilesA[3,1], lty=2, col="aquamarine4"); # 75% INFERIOR
abline(v=CuantilesA[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesA[5,1], lty=2, col="brown"); # 85% INFERIOR
abline(v=CuantilesA[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesA[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesA[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesA[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesA[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesA[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesA[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2   pEhEx - ADJUSTED (sample 3)', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[2,1], lty=2, col="darkblue");  # 70% INFERIOR
abline(v=CuantilesD[2,2], lty=2, col="darkblue"); # 70% SUPERIOR
abline(v=CuantilesD[3,1], lty=2, col="aquamarine4");  # 75% INFERIOR
abline(v=CuantilesD[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesD[5,1], lty=2, col="brown");  # 85% INFERIOR
abline(v=CuantilesD[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesD[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesD[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesD[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesD[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesD[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesD[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))

Grafica Cuantiles del \(65\%\) y \(80\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2  pEhEx - DATA (sample 2)', lty=9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2  BaseMean - ADJUSTED (sample 3)', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))

Grafica Cuantiles del \(70\%\) y \(85\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence, 
     main = 'Normalized Log2 pEhEx - DATA (sample 3)', lty=9)

abline(v=CuantilesA[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesA[2,2], lty=2, col="darkblue")
abline(v=CuantilesA[5,1], lty=2, col="brown"); 
abline(v=CuantilesA[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2  pEhEx - ADJUSTED (sample 3)', lty=9)

abline(v=CuantilesD[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesD[2,2], lty=2, col="darkblue")
abline(v=CuantilesD[5,1], lty=2, col="brown"); 
abline(v=CuantilesD[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))

Muestra pEhExvsCDC51

log2vsCDC51 <- data2$log2samplevsCDC51; head(mean(log2vsCDC51)); head(sd(log2vsCDC51))
## [1] 6.360533
## [1] 2.885557
head(log2vsCDC51,5)
## [1] 5.533681 6.067020 9.454456 9.467709 6.577919
ndata2    <- length(log2vsCDC51)
hist(log2vsCDC51, breaks = nbreaks, col= rainbow(25,0.3), 
     main = 'Log2vsCDC51')

meanlog2vsCDC51 <- mean(log2vsCDC51); head(meanlog2vsCDC51)
## [1] 6.360533
StdDevlog2vsCDC51 <- sd(log2vsCDC51); head(StdDevlog2vsCDC51)
## [1] 2.885557
Normlog2vsCDC51 <- (log2vsCDC51-meanlog2vsCDC51)/StdDevlog2vsCDC51; head(Normlog2vsCDC51)
## [1] -0.28654857 -0.10171821  1.07220996  1.07680301  0.07533583 -0.16330282
tst<- Normlog2vsCDC51

Primer histograma

hist(tst, breaks = nbreaks, col= 1:5, 
     main = 'Normalized Log2vsCDC51',
     xlab='pEhEx1',
     ylab= 'Frequency pEhEx')

Ajustando modelo

fw1<-fitdist(tst, "norm")
plotdist(tst, histo = TRUE, demp = TRUE)

nnorm.f <- fitdist(tst,"norm")
summary(nnorm.f)
## Fitting of the distribution ' norm ' by maximum likelihood 
## Parameters : 
##          estimate Std. Error
## mean 4.727431e-17 0.01459893
## sd   9.998934e-01 0.01032296
## Loglikelihood:  -6655.741   AIC:  13315.48   BIC:  13328.39 
## Correlation matrix:
##              mean           sd
## mean 1.000000e+00 3.426614e-11
## sd   3.426614e-11 1.000000e+00
par(mfrow=c(2,2))
denscomp(nnorm.f,legendtext = 'Dist Normal')
qqcomp(nnorm.f,legendtext = 'Dist Normal')
cdfcomp(nnorm.f,legendtext = 'Dist Normal')
ppcomp(nnorm.f,legendtext = 'Dist Normal')

probs <- c();
probs[8] = 0.175;  probs[9] = 0.825; 
probs[7] = 0.15;   probs[10] = 0.85;   
probs[6] = 0.125;  probs[11] = 0.875; 
probs[5] = 0.1;    probs[12] = 0.9;    
probs[4] = 0.075;  probs[13] = 0.925; 
probs[3] = 0.05;   probs[14] = 0.95;   
probs[2] = 0.025;  probs[15] = 0.975; 
probs[1] = 0.005;  probs[16] = 0.995;  
CuantilesData <- quantile(tst,prob = probs)
CuantilesModel <- qnorm(probs, mean=0, sd=1)
Cuantilillos <- t(CuantilesModel)
colnames(Cuantilillos) <- c('0.5%','2.5%','5%','7.5%',
                            '10%','12.5%','15%','17.5%',
                            '82.5%','85%','87.5%','90%',
                            '92.5%','95%','97.5%','99.5%')
Cuantilillos <- t(Cuantilillos)
colnames(Cuantilillos) <- c('Cuantiles Ajuste')
print(Cuantilillos)
##       Cuantiles Ajuste
## 0.5%        -2.5758293
## 2.5%        -1.9599640
## 5%          -1.6448536
## 7.5%        -1.4395315
## 10%         -1.2815516
## 12.5%       -1.1503494
## 15%         -1.0364334
## 17.5%       -0.9345893
## 82.5%        0.9345893
## 85%          1.0364334
## 87.5%        1.1503494
## 90%          1.2815516
## 92.5%        1.4395315
## 95%          1.6448536
## 97.5%        1.9599640
## 99.5%        2.5758293
CuantilesA <- matrix(0,8,2)
CuantilesD <- matrix(0,8,2)
colnames(CuantilesA) <- c('LimInf','LimSup')
colnames(CuantilesD) <- c('LimInf','LimSup')
rownames(CuantilesA) <- c('65','70','75','80','85','90','95','99')
rownames(CuantilesD) <- c('65','70','75','80','85','90','95','99')
CuantilesA[1,1] <-CuantilesData[8]; CuantilesA[1,2] <-CuantilesData[9]
CuantilesA[2,1] <-CuantilesData[7]; CuantilesA[2,2] <-CuantilesData[10]
CuantilesA[3,1] <-CuantilesData[6]; CuantilesA[3,2] <-CuantilesData[11]
CuantilesA[4,1] <-CuantilesData[5]; CuantilesA[4,2] <-CuantilesData[12]
CuantilesA[5,1] <-CuantilesData[4]; CuantilesA[5,2] <-CuantilesData[13]
CuantilesA[6,1] <-CuantilesData[3]; CuantilesA[6,2] <-CuantilesData[14]
CuantilesA[7,1] <-CuantilesData[2]; CuantilesA[7,2] <-CuantilesData[15]
CuantilesA[8,1] <-CuantilesData[1]; CuantilesA[8,2] <-CuantilesData[16]
CuantilesD[1,1] <-Cuantilillos[8];  CuantilesD[1,2] <-Cuantilillos[9]
CuantilesD[2,1] <-Cuantilillos[7];  CuantilesD[2,2] <-Cuantilillos[10]
CuantilesD[3,1] <-Cuantilillos[6];  CuantilesD[3,2] <-Cuantilillos[11]
CuantilesD[4,1] <-Cuantilillos[5];  CuantilesD[4,2] <-Cuantilillos[12]
CuantilesD[5,1] <-Cuantilillos[4];  CuantilesD[5,2] <-Cuantilillos[13]
CuantilesD[6,1] <-Cuantilillos[3];  CuantilesD[6,2] <-Cuantilillos[14]
CuantilesD[7,1] <-Cuantilillos[2];  CuantilesD[7,2] <-Cuantilillos[15]
CuantilesD[8,1] <-Cuantilillos[1];  CuantilesD[8,2] <-Cuantilillos[16]
print(CuantilesD)
##        LimInf    LimSup
## 65 -0.9345893 0.9345893
## 70 -1.0364334 1.0364334
## 75 -1.1503494 1.1503494
## 80 -1.2815516 1.2815516
## 85 -1.4395315 1.4395315
## 90 -1.6448536 1.6448536
## 95 -1.9599640 1.9599640
## 99 -2.5758293 2.5758293
print(CuantilesA)
##        LimInf    LimSup
## 65 -0.8422310 0.8070408
## 70 -0.8866144 0.9258394
## 75 -0.9353250 1.1082535
## 80 -0.9892988 1.3411647
## 85 -1.0498123 1.6503084
## 90 -1.1186718 2.1232202
## 95 -1.2936703 2.7259168
## 99 -2.2042655 3.3471237

Histogramas

col_sequence <- rainbow(n = 7, alpha = 0.35, start = 0, end = 1)
par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC51 pEhEx - DATA', lty = 9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[2,1], lty=2, col="darkblue"); # 70% INFERIOR
abline(v=CuantilesA[2,2], lty=2, col="darkblue") # 70% SUPERIOR
abline(v=CuantilesA[3,1], lty=2, col="aquamarine4"); # 75% INFERIOR
abline(v=CuantilesA[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesA[5,1], lty=2, col="brown"); # 85% INFERIOR
abline(v=CuantilesA[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesA[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesA[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesA[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesA[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesA[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesA[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC51   pEhEx - ADJUSTED', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[2,1], lty=2, col="darkblue");  # 70% INFERIOR
abline(v=CuantilesD[2,2], lty=2, col="darkblue"); # 70% SUPERIOR
abline(v=CuantilesD[3,1], lty=2, col="aquamarine4");  # 75% INFERIOR
abline(v=CuantilesD[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesD[5,1], lty=2, col="brown");  # 85% INFERIOR
abline(v=CuantilesD[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesD[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesD[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesD[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesD[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesD[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesD[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))

Grafica Cuantiles del \(65\%\) y \(80\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC51  pEhEx - DATA', lty=9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC51  - ADJUSTED', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))

Grafica Cuantiles del \(70\%\) y \(85\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence, 
     main = 'Normalized Log2vsCDC51 pEhEx - DATA', lty=9)

abline(v=CuantilesA[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesA[2,2], lty=2, col="darkblue")
abline(v=CuantilesA[5,1], lty=2, col="brown"); 
abline(v=CuantilesA[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC51  pEhEx - ADJUSTED', lty=9)

abline(v=CuantilesD[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesD[2,2], lty=2, col="darkblue")
abline(v=CuantilesD[5,1], lty=2, col="brown"); 
abline(v=CuantilesD[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))

Muestra pEhExvsCDC52

log2vsCDC52 <- data2$log2samplevsCDC52; head(mean(log2vsCDC52)); head(sd(log2vsCDC52))
## [1] 6.456006
## [1] 2.961412
head(log2vsCDC52,5)
## [1]  6.765897  8.316266 10.325819  8.752087  6.781024

Primer Histograma

ndata2    <- length(log2vsCDC52)
hist(log2vsCDC52, breaks = nbreaks, col= rainbow(25,0.3), 
     main = 'Log2vsCDC52')

meanlog2vsCDC52 <- mean(log2vsCDC52); head(meanlog2vsCDC52)
## [1] 6.456006
StdDevlog2vsCDC52 <- sd(log2vsCDC52); head(StdDevlog2vsCDC52)
## [1] 2.961412
Normlog2vsCDC52 <- (log2vsCDC52-meanlog2vsCDC52)/StdDevlog2vsCDC52; head(Normlog2vsCDC52)
## [1]  0.1046430  0.6281664  1.3067458  0.7753331  0.1097511 -0.2601055
tst<- Normlog2vsCDC52

** Segundo Histograma**

hist(tst, breaks = nbreaks, col= 1:5, 
     main = 'Normalized Log2vsCDC52',
     xlab='pEhEx1',
     ylab= 'Frequency pEhEx')

Ajustando modelo

fw1<-fitdist(tst, "norm")
plotdist(tst, histo = TRUE, demp = TRUE)

nnorm.f <- fitdist(tst,"norm")
summary(nnorm.f)
## Fitting of the distribution ' norm ' by maximum likelihood 
## Parameters : 
##           estimate Std. Error
## mean -1.572806e-17 0.01459893
## sd    9.998934e-01 0.01032296
## Loglikelihood:  -6655.741   AIC:  13315.48   BIC:  13328.39 
## Correlation matrix:
##      mean sd
## mean    1  0
## sd      0  1
par(mfrow=c(2,2))
denscomp(nnorm.f,legendtext = 'Dist Normal')
qqcomp(nnorm.f,legendtext = 'Dist Normal')
cdfcomp(nnorm.f,legendtext = 'Dist Normal')
ppcomp(nnorm.f,legendtext = 'Dist Normal')

Cálculo de cuantiles

probs <- c();
probs[8] = 0.175;  probs[9] = 0.825; 
probs[7] = 0.15;   probs[10] = 0.85;   
probs[6] = 0.125;  probs[11] = 0.875; 
probs[5] = 0.1;    probs[12] = 0.9;    
probs[4] = 0.075;  probs[13] = 0.925; 
probs[3] = 0.05;   probs[14] = 0.95;   
probs[2] = 0.025;  probs[15] = 0.975; 
probs[1] = 0.005;  probs[16] = 0.995;  
CuantilesData <- quantile(tst,prob = probs)
CuantilesModel <- qnorm(probs, mean=0, sd=1)
Cuantilillos <- t(CuantilesModel)
colnames(Cuantilillos) <- c('0.5%','2.5%','5%','7.5%',
                            '10%','12.5%','15%','17.5%',
                            '82.5%','85%','87.5%','90%',
                            '92.5%','95%','97.5%','99.5%')
Cuantilillos <- t(Cuantilillos)
colnames(Cuantilillos) <- c('Cuantiles Ajuste')
print(Cuantilillos)
##       Cuantiles Ajuste
## 0.5%        -2.5758293
## 2.5%        -1.9599640
## 5%          -1.6448536
## 7.5%        -1.4395315
## 10%         -1.2815516
## 12.5%       -1.1503494
## 15%         -1.0364334
## 17.5%       -0.9345893
## 82.5%        0.9345893
## 85%          1.0364334
## 87.5%        1.1503494
## 90%          1.2815516
## 92.5%        1.4395315
## 95%          1.6448536
## 97.5%        1.9599640
## 99.5%        2.5758293
CuantilesA <- matrix(0,8,2)
CuantilesD <- matrix(0,8,2)
colnames(CuantilesA) <- c('LimInf','LimSup')
colnames(CuantilesD) <- c('LimInf','LimSup')
rownames(CuantilesA) <- c('65','70','75','80','85','90','95','99')
rownames(CuantilesD) <- c('65','70','75','80','85','90','95','99')
CuantilesA[1,1] <-CuantilesData[8]; CuantilesA[1,2] <-CuantilesData[9]
CuantilesA[2,1] <-CuantilesData[7]; CuantilesA[2,2] <-CuantilesData[10]
CuantilesA[3,1] <-CuantilesData[6]; CuantilesA[3,2] <-CuantilesData[11]
CuantilesA[4,1] <-CuantilesData[5]; CuantilesA[4,2] <-CuantilesData[12]
CuantilesA[5,1] <-CuantilesData[4]; CuantilesA[5,2] <-CuantilesData[13]
CuantilesA[6,1] <-CuantilesData[3]; CuantilesA[6,2] <-CuantilesData[14]
CuantilesA[7,1] <-CuantilesData[2]; CuantilesA[7,2] <-CuantilesData[15]
CuantilesA[8,1] <-CuantilesData[1]; CuantilesA[8,2] <-CuantilesData[16]
CuantilesD[1,1] <-Cuantilillos[8];  CuantilesD[1,2] <-Cuantilillos[9]
CuantilesD[2,1] <-Cuantilillos[7];  CuantilesD[2,2] <-Cuantilillos[10]
CuantilesD[3,1] <-Cuantilillos[6];  CuantilesD[3,2] <-Cuantilillos[11]
CuantilesD[4,1] <-Cuantilillos[5];  CuantilesD[4,2] <-Cuantilillos[12]
CuantilesD[5,1] <-Cuantilillos[4];  CuantilesD[5,2] <-Cuantilillos[13]
CuantilesD[6,1] <-Cuantilillos[3];  CuantilesD[6,2] <-Cuantilillos[14]
CuantilesD[7,1] <-Cuantilillos[2];  CuantilesD[7,2] <-Cuantilillos[15]
CuantilesD[8,1] <-Cuantilillos[1];  CuantilesD[8,2] <-Cuantilillos[16]
print(CuantilesD)
##        LimInf    LimSup
## 65 -0.9345893 0.9345893
## 70 -1.0364334 1.0364334
## 75 -1.1503494 1.1503494
## 80 -1.2815516 1.2815516
## 85 -1.4395315 1.4395315
## 90 -1.6448536 1.6448536
## 95 -1.9599640 1.9599640
## 99 -2.5758293 2.5758293
print(CuantilesA)
##        LimInf    LimSup
## 65 -0.8684632 0.8127421
## 70 -0.9078618 0.9668311
## 75 -0.9977360 1.1263553
## 80 -1.0497676 1.3726202
## 85 -1.1080283 1.6925494
## 90 -1.1742151 2.1332703
## 95 -1.3417825 2.5710200
## 99 -2.1800429 3.1603637

Histogramas

col_sequence <- rainbow(n = 7, alpha = 0.35, start = 0, end = 1)
par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC52 pEhEx - DATA', lty = 9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[2,1], lty=2, col="darkblue"); # 70% INFERIOR
abline(v=CuantilesA[2,2], lty=2, col="darkblue") # 70% SUPERIOR
abline(v=CuantilesA[3,1], lty=2, col="aquamarine4"); # 75% INFERIOR
abline(v=CuantilesA[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesA[5,1], lty=2, col="brown"); # 85% INFERIOR
abline(v=CuantilesA[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesA[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesA[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesA[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesA[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesA[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesA[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC52   pEhEx - ADJUSTED', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[2,1], lty=2, col="darkblue");  # 70% INFERIOR
abline(v=CuantilesD[2,2], lty=2, col="darkblue"); # 70% SUPERIOR
abline(v=CuantilesD[3,1], lty=2, col="aquamarine4");  # 75% INFERIOR
abline(v=CuantilesD[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesD[5,1], lty=2, col="brown");  # 85% INFERIOR
abline(v=CuantilesD[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesD[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesD[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesD[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesD[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesD[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesD[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))

Grafica Cuantiles del \(65\%\) y \(80\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC52  pEhEx - DATA', lty=9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC52  - ADJUSTED', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))

Grafica Cuantiles del \(70\%\) y \(85\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence, 
     main = 'Normalized Log2vsCDC52 pEhEx - DATA', lty=9)

abline(v=CuantilesA[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesA[2,2], lty=2, col="darkblue")
abline(v=CuantilesA[5,1], lty=2, col="brown"); 
abline(v=CuantilesA[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC52  pEhEx - ADJUSTED', lty=9)

abline(v=CuantilesD[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesD[2,2], lty=2, col="darkblue")
abline(v=CuantilesD[5,1], lty=2, col="brown"); 
abline(v=CuantilesD[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))

Muestra pEhExvsCDC53

log2vsCDC53 <- data2$log2samplevsCDC53; head(mean(log2vsCDC53)); head(sd(log2vsCDC53))
## [1] 6.53086
## [1] 2.83016
head(log2vsCDC53,5)
## [1] 7.018629 8.013055 9.778825 8.607266 5.176245
ndata2    <- length(log2vsCDC53)

** Primer histograma**

hist(log2vsCDC53, breaks = nbreaks, col= rainbow(25,0.3), 
     main = 'Log2vsCDC53')

meanlog2vsCDC53 <- mean(log2vsCDC53); head(meanlog2vsCDC53)
## [1] 6.53086
StdDevlog2vsCDC53 <- sd(log2vsCDC53); head(StdDevlog2vsCDC53)
## [1] 2.83016
Normlog2vsCDC53 <- (log2vsCDC53-meanlog2vsCDC53)/StdDevlog2vsCDC53; head(Normlog2vsCDC53)
## [1]  0.17234655  0.52371392  1.14762562  0.73367078 -0.47863552 -0.06255138
tst<- Normlog2vsCDC53

Segundo histograma

hist(tst, breaks = nbreaks, col= 1:5, 
     main = 'Normalized Log2vsCDC53',
     xlab='pEhEx1',
     ylab= 'Frequency pEhEx')

Ajustando modelo

fw1<-fitdist(tst, "norm")
plotdist(tst, histo = TRUE, demp = TRUE)

nnorm.f <- fitdist(tst,"norm")
summary(nnorm.f)
## Fitting of the distribution ' norm ' by maximum likelihood 
## Parameters : 
##          estimate Std. Error
## mean 4.356074e-17 0.01459893
## sd   9.998934e-01 0.01032296
## Loglikelihood:  -6655.741   AIC:  13315.48   BIC:  13328.39 
## Correlation matrix:
##               mean            sd
## mean  1.000000e+00 -3.426614e-11
## sd   -3.426614e-11  1.000000e+00
par(mfrow=c(2,2))
denscomp(nnorm.f,legendtext = 'Dist Normal')
qqcomp(nnorm.f,legendtext = 'Dist Normal')
cdfcomp(nnorm.f,legendtext = 'Dist Normal')
ppcomp(nnorm.f,legendtext = 'Dist Normal')

Calculo de cuantiles

probs <- c();
probs[8] = 0.175;  probs[9] = 0.825; 
probs[7] = 0.15;   probs[10] = 0.85;   
probs[6] = 0.125;  probs[11] = 0.875; 
probs[5] = 0.1;    probs[12] = 0.9;    
probs[4] = 0.075;  probs[13] = 0.925; 
probs[3] = 0.05;   probs[14] = 0.95;   
probs[2] = 0.025;  probs[15] = 0.975; 
probs[1] = 0.005;  probs[16] = 0.995;  
CuantilesData <- quantile(tst,prob = probs)
CuantilesModel <- qnorm(probs, mean=0, sd=1)
Cuantilillos <- t(CuantilesModel)
colnames(Cuantilillos) <- c('0.5%','2.5%','5%','7.5%',
                            '10%','12.5%','15%','17.5%',
                            '82.5%','85%','87.5%','90%',
                            '92.5%','95%','97.5%','99.5%')
Cuantilillos <- t(Cuantilillos)
colnames(Cuantilillos) <- c('Cuantiles Ajuste')
print(Cuantilillos)
##       Cuantiles Ajuste
## 0.5%        -2.5758293
## 2.5%        -1.9599640
## 5%          -1.6448536
## 7.5%        -1.4395315
## 10%         -1.2815516
## 12.5%       -1.1503494
## 15%         -1.0364334
## 17.5%       -0.9345893
## 82.5%        0.9345893
## 85%          1.0364334
## 87.5%        1.1503494
## 90%          1.2815516
## 92.5%        1.4395315
## 95%          1.6448536
## 97.5%        1.9599640
## 99.5%        2.5758293
CuantilesA <- matrix(0,8,2)
CuantilesD <- matrix(0,8,2)
colnames(CuantilesA) <- c('LimInf','LimSup')
colnames(CuantilesD) <- c('LimInf','LimSup')
rownames(CuantilesA) <- c('65','70','75','80','85','90','95','99')
rownames(CuantilesD) <- c('65','70','75','80','85','90','95','99')
CuantilesA[1,1] <-CuantilesData[8]; CuantilesA[1,2] <-CuantilesData[9]
CuantilesA[2,1] <-CuantilesData[7]; CuantilesA[2,2] <-CuantilesData[10]
CuantilesA[3,1] <-CuantilesData[6]; CuantilesA[3,2] <-CuantilesData[11]
CuantilesA[4,1] <-CuantilesData[5]; CuantilesA[4,2] <-CuantilesData[12]
CuantilesA[5,1] <-CuantilesData[4]; CuantilesA[5,2] <-CuantilesData[13]
CuantilesA[6,1] <-CuantilesData[3]; CuantilesA[6,2] <-CuantilesData[14]
CuantilesA[7,1] <-CuantilesData[2]; CuantilesA[7,2] <-CuantilesData[15]
CuantilesA[8,1] <-CuantilesData[1]; CuantilesA[8,2] <-CuantilesData[16]
CuantilesD[1,1] <-Cuantilillos[8];  CuantilesD[1,2] <-Cuantilillos[9]
CuantilesD[2,1] <-Cuantilillos[7];  CuantilesD[2,2] <-Cuantilillos[10]
CuantilesD[3,1] <-Cuantilillos[6];  CuantilesD[3,2] <-Cuantilillos[11]
CuantilesD[4,1] <-Cuantilillos[5];  CuantilesD[4,2] <-Cuantilillos[12]
CuantilesD[5,1] <-Cuantilillos[4];  CuantilesD[5,2] <-Cuantilillos[13]
CuantilesD[6,1] <-Cuantilillos[3];  CuantilesD[6,2] <-Cuantilillos[14]
CuantilesD[7,1] <-Cuantilillos[2];  CuantilesD[7,2] <-Cuantilillos[15]
CuantilesD[8,1] <-Cuantilillos[1];  CuantilesD[8,2] <-Cuantilillos[16]
print(CuantilesD)
##        LimInf    LimSup
## 65 -0.9345893 0.9345893
## 70 -1.0364334 1.0364334
## 75 -1.1503494 1.1503494
## 80 -1.2815516 1.2815516
## 85 -1.4395315 1.4395315
## 90 -1.6448536 1.6448536
## 95 -1.9599640 1.9599640
## 99 -2.5758293 2.5758293
print(CuantilesA)
##        LimInf    LimSup
## 65 -0.8498210 0.8013314
## 70 -0.8954944 0.9236834
## 75 -0.9456663 1.1144463
## 80 -1.0013208 1.3533967
## 85 -1.0316061 1.7113380
## 90 -1.0981755 2.2519051
## 95 -1.2178539 2.7028284
## 99 -1.5625210 3.3998336

Histogramas

col_sequence <- rainbow(n = 7, alpha = 0.35, start = 0, end = 1)
par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC53 pEhEx - DATA', lty = 9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[2,1], lty=2, col="darkblue"); # 70% INFERIOR
abline(v=CuantilesA[2,2], lty=2, col="darkblue") # 70% SUPERIOR
abline(v=CuantilesA[3,1], lty=2, col="aquamarine4"); # 75% INFERIOR
abline(v=CuantilesA[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesA[5,1], lty=2, col="brown"); # 85% INFERIOR
abline(v=CuantilesA[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesA[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesA[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesA[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesA[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesA[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesA[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC53   pEhEx - ADJUSTED', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[2,1], lty=2, col="darkblue");  # 70% INFERIOR
abline(v=CuantilesD[2,2], lty=2, col="darkblue"); # 70% SUPERIOR
abline(v=CuantilesD[3,1], lty=2, col="aquamarine4");  # 75% INFERIOR
abline(v=CuantilesD[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesD[5,1], lty=2, col="brown");  # 85% INFERIOR
abline(v=CuantilesD[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesD[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesD[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesD[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesD[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesD[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesD[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))

Grafica Cuantiles del \(65\%\) y \(80\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC53  pEhEx - DATA', lty=9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC51  - ADJUSTED', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))

Grafica Cuantiles del \(70\%\) y \(85\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence, 
     main = 'Normalized Log2vsCDC53 pEhEx - DATA', lty=9)

abline(v=CuantilesA[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesA[2,2], lty=2, col="darkblue")
abline(v=CuantilesA[5,1], lty=2, col="brown"); 
abline(v=CuantilesA[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC53  pEhEx - ADJUSTED', lty=9)

abline(v=CuantilesD[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesD[2,2], lty=2, col="darkblue")
abline(v=CuantilesD[5,1], lty=2, col="brown"); 
abline(v=CuantilesD[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))

Tercera Clasificacion: pEhExvsEhMyb10

head(pEhExvsEhMyb10,10);
## # A tibble: 10 × 7
##    GenId       CDC5_1 CDC5_2   CDC5_3 pEhEx_1 pEhEx_2 pEhEx_3
##    <chr>        <dbl>  <dbl>    <dbl>   <dbl>   <dbl>   <dbl>
##  1 EHI_000130A   69.9   61.2   502.     140.    346.   366.  
##  2 EHI_000140A  216.    28.8    65.9    281.    272.    29.6 
##  3 EHI_000240A  851.   489.  12365.     936.   1544.  1622.  
##  4 EHI_000250A  413.   616.   1844.     259.    261.   503.  
##  5 EHI_000260A   81.6   77.4   517.      86.9    53.5   38.4 
##  6 EHI_000280A   35.9   48.6    59.6     43.7    66.7   47.2 
##  7 EHI_000290A   12.6   23.4    47.0     14.8    11.3   62.0 
##  8 EHI_000300A  104.    68.4     9.41   106.     92.0   24.2 
##  9 EHI_000410A   17.0   10.8   144.      22.5    19.7   50.0 
## 10 EHI_000430A   18.8   19.8    25.1     20.7    11.3    8.24
nbreaks <- 10
data3 <- pEhExvsEhMyb10;       head(data3)
## # A tibble: 6 × 7
##   GenId       CDC5_1 CDC5_2  CDC5_3 pEhEx_1 pEhEx_2 pEhEx_3
##   <chr>        <dbl>  <dbl>   <dbl>   <dbl>   <dbl>   <dbl>
## 1 EHI_000130A   69.9   61.2   502.    140.    346.    366. 
## 2 EHI_000140A  216.    28.8    65.9   281.    272.     29.6
## 3 EHI_000240A  851.   489.  12365.    936.   1544.   1622. 
## 4 EHI_000250A  413.   616.   1844.    259.    261.    503. 
## 5 EHI_000260A   81.6   77.4   517.     86.9    53.5    38.4
## 6 EHI_000280A   35.9   48.6    59.6    43.7    66.7    47.2

Log-Normalización

sample1   <- data3$pEhEx_1; sample2   <- data3$pEhEx_2; sample3   <- data3$pEhEx_3;
samplevs1 <- data3$CDC5_1;  samplevs2 <- data3$CDC5_2;  samplevs3 <- data3$CDC5_3;
log2sample1 <- log2(sample1+1);         log2sample2 <- log2(sample2+1)
log2sample3 <- log2(sample3+1);         log2samplevsCDC51 <- log2(samplevs1+1)
log2samplevsCDC52 <- log2(samplevs2+1); log2samplevsCDC53 <- log2(samplevs3+1)
data3 <- cbind(data3, log2sample1,log2sample2,log2sample3,
               log2samplevsCDC51,log2samplevsCDC52,log2samplevsCDC53)
head(data3)
##         GenId    CDC5_1    CDC5_2      CDC5_3   pEhEx_1    pEhEx_2    pEhEx_3
## 1 EHI_000130A  69.92805  61.19384   501.73716 139.50869  345.55778  365.63668
## 2 EHI_000140A 216.05975  28.79710    65.85300 281.38193  272.31456   29.64622
## 3 EHI_000240A 850.79131 488.65084 12364.68511 936.36340 1543.74183 1622.30687
## 4 EHI_000250A 413.29272 616.43798  1843.88406 258.91867  261.04637  503.43668
## 5 EHI_000260A  81.58273  77.39221   517.41645  86.89736   53.52390   38.43028
## 6 EHI_000280A  35.86054  48.59511    59.58129  43.74425   66.67012   47.21435
##   log2sample1 log2sample2 log2sample3 log2samplevsCDC51 log2samplevsCDC52
## 1    7.134516    8.436952    8.518207          6.148284          5.958700
## 2    8.141504    8.094418    4.937637          7.761948          4.897100
## 3    9.872465   10.593150   10.664720          9.734356          8.935610
## 4    8.021916    8.033678    8.978529          8.694507          9.270150
## 5    6.457748    5.768817    5.301232          6.367768          6.292638
## 6    5.483630    6.080447    5.591391          5.204005          5.632126
##   log2samplevsCDC53
## 1          8.973661
## 2          6.062920
## 3         13.594055
## 4         10.849314
## 5          9.017968
## 6          5.920800
save.image('CheckPointFourth.RData')
setwd("~/Documents/GitHub/Resultados/docs/PrimeroDiffExpAllResults/Clasificando/Abundances")
#load('CheckPointTwo.RData')
library(ggplot2);library(dplyr);library("fitdistrplus");
library("MASS");library("survival")
head(data3)
##         GenId    CDC5_1    CDC5_2      CDC5_3   pEhEx_1    pEhEx_2    pEhEx_3
## 1 EHI_000130A  69.92805  61.19384   501.73716 139.50869  345.55778  365.63668
## 2 EHI_000140A 216.05975  28.79710    65.85300 281.38193  272.31456   29.64622
## 3 EHI_000240A 850.79131 488.65084 12364.68511 936.36340 1543.74183 1622.30687
## 4 EHI_000250A 413.29272 616.43798  1843.88406 258.91867  261.04637  503.43668
## 5 EHI_000260A  81.58273  77.39221   517.41645  86.89736   53.52390   38.43028
## 6 EHI_000280A  35.86054  48.59511    59.58129  43.74425   66.67012   47.21435
##   log2sample1 log2sample2 log2sample3 log2samplevsCDC51 log2samplevsCDC52
## 1    7.134516    8.436952    8.518207          6.148284          5.958700
## 2    8.141504    8.094418    4.937637          7.761948          4.897100
## 3    9.872465   10.593150   10.664720          9.734356          8.935610
## 4    8.021916    8.033678    8.978529          8.694507          9.270150
## 5    6.457748    5.768817    5.301232          6.367768          6.292638
## 6    5.483630    6.080447    5.591391          5.204005          5.632126
##   log2samplevsCDC53
## 1          8.973661
## 2          6.062920
## 3         13.594055
## 4         10.849314
## 5          9.017968
## 6          5.920800

Muestra 1

log2sample1 <- data3$log2sample1; head(mean(log2sample1)); head(sd(log2sample1))
## [1] 6.089174
## [1] 2.844545
head(log2sample1,5)
## [1] 7.134516 8.141504 9.872465 8.021916 6.457748
summary(data3)
##     GenId               CDC5_1              CDC5_2             CDC5_3         
##  Length:4687        Min.   :     0.00   Min.   :     0.0   Min.   :      0.0  
##  Class :character   1st Qu.:    14.34   1st Qu.:    16.2   1st Qu.:     12.5  
##  Mode  :character   Median :    41.24   Median :    41.4   Median :     50.2  
##                     Mean   :  1568.76   Mean   :  1496.5   Mean   :   4142.0  
##                     3rd Qu.:   189.61   3rd Qu.:   167.4   3rd Qu.:    239.9  
##                     Max.   :247688.75   Max.   :404961.1   Max.   :2325768.1  
##     pEhEx_1             pEhEx_2             pEhEx_3          log2sample1    
##  Min.   :     0.00   Min.   :     0.00   Min.   :     0.0   Min.   : 0.000  
##  1st Qu.:    15.37   1st Qu.:    14.09   1st Qu.:    12.6   1st Qu.: 4.033  
##  Median :    43.15   Median :    44.13   Median :    43.9   Median : 5.464  
##  Mean   :  1165.87   Mean   :  1467.37   Mean   :  1522.5   Mean   : 6.089  
##  3rd Qu.:   176.16   3rd Qu.:   194.38   3rd Qu.:   193.2   3rd Qu.: 7.469  
##  Max.   :170161.59   Max.   :223245.35   Max.   :553907.7   Max.   :17.377  
##   log2sample2      log2sample3     log2samplevsCDC51 log2samplevsCDC52
##  Min.   : 0.000   Min.   : 0.000   Min.   : 0.000    Min.   : 0.000   
##  1st Qu.: 3.915   1st Qu.: 3.768   1st Qu.: 3.940    1st Qu.: 4.104   
##  Median : 5.496   Median : 5.489   Median : 5.401    Median : 5.406   
##  Mean   : 6.054   Mean   : 5.945   Mean   : 6.079    Mean   : 6.086   
##  3rd Qu.: 7.610   3rd Qu.: 7.602   3rd Qu.: 7.574    3rd Qu.: 7.396   
##  Max.   :17.768   Max.   :19.079   Max.   :17.918    Max.   :18.627   
##  log2samplevsCDC53
##  Min.   : 0.000   
##  1st Qu.: 3.760   
##  Median : 5.677   
##  Mean   : 6.068   
##  3rd Qu.: 7.912   
##  Max.   :21.149
ndata3    <- length(log2sample1)
hist(log2sample1, breaks = nbreaks, col= rainbow(25,0.3), 
     main = 'Log2 sample1')

meanlog2sample1 <- mean(log2sample1); head(meanlog2sample1)
## [1] 6.089174
StdDevlog2sample1 <- sd(log2sample1); head(StdDevlog2sample1)
## [1] 2.844545
Normlog2sample1 <- (log2sample1-meanlog2sample1)/StdDevlog2sample1; head(Normlog2sample1)
## [1]  0.3674899  0.7214968  1.3300161  0.6794558  0.1295722 -0.2128788
tst<- Normlog2sample1

hist(tst, breaks = nbreaks, col= 1:5, 
     main = 'Normalized Log2sample1',
     xlab='pEhEx1',
     ylab= 'Frequency pEhEx')

fw1<-fitdist(tst, "norm")
plotdist(tst, histo = TRUE, demp = TRUE)

nnorm.f <- fitdist(tst,"norm")
summary(nnorm.f)
## Fitting of the distribution ' norm ' by maximum likelihood 
## Parameters : 
##          estimate Std. Error
## mean 3.587875e-17 0.01460516
## sd   9.998933e-01 0.01032736
## Loglikelihood:  -6650.065   AIC:  13304.13   BIC:  13317.03 
## Correlation matrix:
##               mean            sd
## mean  1.000000e+00 -3.429538e-11
## sd   -3.429538e-11  1.000000e+00
par(mfrow=c(2,2))
denscomp(nnorm.f,legendtext = 'Dist Normal')
qqcomp(nnorm.f,legendtext = 'Dist Normal')
cdfcomp(nnorm.f,legendtext = 'Dist Normal')
ppcomp(nnorm.f,legendtext = 'Dist Normal')

probs <- c();
probs[8] = 0.175;  probs[9] = 0.825; 
probs[7] = 0.15;   probs[10] = 0.85;   
probs[6] = 0.125;  probs[11] = 0.875; 
probs[5] = 0.1;    probs[12] = 0.9;    
probs[4] = 0.075;  probs[13] = 0.925; 
probs[3] = 0.05;   probs[14] = 0.95;   
probs[2] = 0.025;  probs[15] = 0.975; 
probs[1] = 0.005;  probs[16] = 0.995;  
CuantilesData <- quantile(tst,prob = probs)
CuantilesModel <- qnorm(probs, mean=0, sd=1)
Cuantilillos <- t(CuantilesModel)
colnames(Cuantilillos) <- c('0.5%','2.5%','5%','7.5%',
                            '10%','12.5%','15%','17.5%',
                            '82.5%','85%','87.5%','90%',
                            '92.5%','95%','97.5%','99.5%')
Cuantilillos <- t(Cuantilillos)
colnames(Cuantilillos) <- c('Cuantiles Ajuste')
print(Cuantilillos)
##       Cuantiles Ajuste
## 0.5%        -2.5758293
## 2.5%        -1.9599640
## 5%          -1.6448536
## 7.5%        -1.4395315
## 10%         -1.2815516
## 12.5%       -1.1503494
## 15%         -1.0364334
## 17.5%       -0.9345893
## 82.5%        0.9345893
## 85%          1.0364334
## 87.5%        1.1503494
## 90%          1.2815516
## 92.5%        1.4395315
## 95%          1.6448536
## 97.5%        1.9599640
## 99.5%        2.5758293

Cálculo de cuantiles

CuantilesA <- matrix(0,8,2)
CuantilesD <- matrix(0,8,2)
colnames(CuantilesA) <- c('LimInf','LimSup')
colnames(CuantilesD) <- c('LimInf','LimSup')
rownames(CuantilesA) <- c('65','70','75','80','85','90','95','99')
rownames(CuantilesD) <- c('65','70','75','80','85','90','95','99')
CuantilesA[1,1] <-CuantilesData[8]; CuantilesA[1,2] <-CuantilesData[9]
CuantilesA[2,1] <-CuantilesData[7]; CuantilesA[2,2] <-CuantilesData[10]
CuantilesA[3,1] <-CuantilesData[6]; CuantilesA[3,2] <-CuantilesData[11]
CuantilesA[4,1] <-CuantilesData[5]; CuantilesA[4,2] <-CuantilesData[12]
CuantilesA[5,1] <-CuantilesData[4]; CuantilesA[5,2] <-CuantilesData[13]
CuantilesA[6,1] <-CuantilesData[3]; CuantilesA[6,2] <-CuantilesData[14]
CuantilesA[7,1] <-CuantilesData[2]; CuantilesA[7,2] <-CuantilesData[15]
CuantilesA[8,1] <-CuantilesData[1]; CuantilesA[8,2] <-CuantilesData[16]
CuantilesD[1,1] <-Cuantilillos[8];  CuantilesD[1,2] <-Cuantilillos[9]
CuantilesD[2,1] <-Cuantilillos[7];  CuantilesD[2,2] <-Cuantilillos[10]
CuantilesD[3,1] <-Cuantilillos[6];  CuantilesD[3,2] <-Cuantilillos[11]
CuantilesD[4,1] <-Cuantilillos[5];  CuantilesD[4,2] <-Cuantilillos[12]
CuantilesD[5,1] <-Cuantilillos[4];  CuantilesD[5,2] <-Cuantilillos[13]
CuantilesD[6,1] <-Cuantilillos[3];  CuantilesD[6,2] <-Cuantilillos[14]
CuantilesD[7,1] <-Cuantilillos[2];  CuantilesD[7,2] <-Cuantilillos[15]
CuantilesD[8,1] <-Cuantilillos[1];  CuantilesD[8,2] <-Cuantilillos[16]
print(CuantilesD)
##        LimInf    LimSup
## 65 -0.9345893 0.9345893
## 70 -1.0364334 1.0364334
## 75 -1.1503494 1.1503494
## 80 -1.2815516 1.2815516
## 85 -1.4395315 1.4395315
## 90 -1.6448536 1.6448536
## 95 -1.9599640 1.9599640
## 99 -2.5758293 2.5758293
print(CuantilesA)
##        LimInf    LimSup
## 65 -0.8467216 0.8152581
## 70 -0.9222155 0.9595311
## 75 -0.9796121 1.1276277
## 80 -1.0443431 1.3803954
## 85 -1.0800958 1.7000005
## 90 -1.1601851 2.1830409
## 95 -1.3725612 2.6106296
## 99 -1.7448623 3.1766074
col_sequence <- rainbow(n = 7, alpha = 0.35, start = 0, end = 1)
par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2 pEhEx - DATA', lty = 9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[2,1], lty=2, col="darkblue"); # 70% INFERIOR
abline(v=CuantilesA[2,2], lty=2, col="darkblue") # 70% SUPERIOR
abline(v=CuantilesA[3,1], lty=2, col="aquamarine4"); # 75% INFERIOR
abline(v=CuantilesA[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesA[5,1], lty=2, col="brown"); # 85% INFERIOR
abline(v=CuantilesA[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesA[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesA[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesA[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesA[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesA[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesA[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2   pEhEx - ADJUSTED', lty=9)
abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[2,1], lty=2, col="darkblue");  # 70% INFERIOR
abline(v=CuantilesD[2,2], lty=2, col="darkblue"); # 70% SUPERIOR
abline(v=CuantilesD[3,1], lty=2, col="aquamarine4");  # 75% INFERIOR
abline(v=CuantilesD[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesD[5,1], lty=2, col="brown");  # 85% INFERIOR
abline(v=CuantilesD[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesD[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesD[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesD[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesD[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesD[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesD[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))

Grafica Cuantiles del \(65\%\) y \(80\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2  pEhEx - DATA', lty=9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2  BaseMean - ADJUSTED', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))

Grafica Cuantiles del \(70\%\) y \(85\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence, 
     main = 'Normalized Log2 pEhEx - DATA', lty=9)

abline(v=CuantilesA[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesA[2,2], lty=2, col="darkblue")
abline(v=CuantilesA[5,1], lty=2, col="brown"); 
abline(v=CuantilesA[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2  pEhEx - ADJUSTED', lty=9)

abline(v=CuantilesD[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesD[2,2], lty=2, col="darkblue")
abline(v=CuantilesD[5,1], lty=2, col="brown"); 
abline(v=CuantilesD[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))

Muestra 2

log2sample2 <- data3$log2sample2; head(mean(log2sample2)); head(sd(log2sample2))
## [1] 6.054099
## [1] 3.081702
head(log2sample2,5)
## [1]  8.436952  8.094418 10.593150  8.033678  5.768817
ndata3    <- length(log2sample2)
hist(log2sample2, breaks = nbreaks, col= rainbow(25,0.3), 
     main = 'Log2 sample2')

Log-normalizacion

meanlog2sample2 <- mean(log2sample2); head(meanlog2sample2)
## [1] 6.054099
StdDevlog2sample2 <- sd(log2sample2); head(StdDevlog2sample2)
## [1] 3.081702
Normlog2sample2 <- (log2sample2-meanlog2sample2)/StdDevlog2sample2; head(Normlog2sample2)
## [1]  0.773226200  0.662075403  1.472903852  0.642365454 -0.092573117
## [6]  0.008549646
tst<- Normlog2sample2
hist(tst, breaks = nbreaks, col= 1:5, 
     main = 'Normalized Log2sample1',
     xlab='pEhEx1',
     ylab= 'Frequency pEhEx')

Ajuste de modelo

fw1<-fitdist(tst, "norm")
plotdist(tst, histo = TRUE, demp = TRUE)

nnorm.f <- fitdist(tst,"norm")
summary(nnorm.f)
## Fitting of the distribution ' norm ' by maximum likelihood 
## Parameters : 
##          estimate Std. Error
## mean 1.403180e-16 0.01460516
## sd   9.998933e-01 0.01032736
## Loglikelihood:  -6650.065   AIC:  13304.13   BIC:  13317.03 
## Correlation matrix:
##              mean           sd
## mean 1.000000e+00 3.429538e-11
## sd   3.429538e-11 1.000000e+00
par(mfrow=c(2,2))
denscomp(nnorm.f,legendtext = 'Dist Normal')
qqcomp(nnorm.f,legendtext = 'Dist Normal')
cdfcomp(nnorm.f,legendtext = 'Dist Normal')
ppcomp(nnorm.f,legendtext = 'Dist Normal')

probs <- c();
probs[8] = 0.175;  probs[9] = 0.825; 
probs[7] = 0.15;   probs[10] = 0.85;   
probs[6] = 0.125;  probs[11] = 0.875; 
probs[5] = 0.1;    probs[12] = 0.9;    
probs[4] = 0.075;  probs[13] = 0.925; 
probs[3] = 0.05;   probs[14] = 0.95;   
probs[2] = 0.025;  probs[15] = 0.975; 
probs[1] = 0.005;  probs[16] = 0.995;  
CuantilesData <- quantile(tst,prob = probs)
CuantilesModel <- qnorm(probs, mean=0, sd=1)
Cuantilillos <- t(CuantilesModel)
colnames(Cuantilillos) <- c('0.5%','2.5%','5%','7.5%',
                            '10%','12.5%','15%','17.5%',
                            '82.5%','85%','87.5%','90%',
                            '92.5%','95%','97.5%','99.5%')
Cuantilillos <- t(Cuantilillos)
colnames(Cuantilillos) <- c('Cuantiles Ajuste')
print(Cuantilillos)
##       Cuantiles Ajuste
## 0.5%        -2.5758293
## 2.5%        -1.9599640
## 5%          -1.6448536
## 7.5%        -1.4395315
## 10%         -1.2815516
## 12.5%       -1.1503494
## 15%         -1.0364334
## 17.5%       -0.9345893
## 82.5%        0.9345893
## 85%          1.0364334
## 87.5%        1.1503494
## 90%          1.2815516
## 92.5%        1.4395315
## 95%          1.6448536
## 97.5%        1.9599640
## 99.5%        2.5758293
CuantilesA <- matrix(0,8,2)
CuantilesD <- matrix(0,8,2)
colnames(CuantilesA) <- c('LimInf','LimSup')
colnames(CuantilesD) <- c('LimInf','LimSup')
rownames(CuantilesA) <- c('65','70','75','80','85','90','95','99')
rownames(CuantilesD) <- c('65','70','75','80','85','90','95','99')
CuantilesA[1,1] <-CuantilesData[8]; CuantilesA[1,2] <-CuantilesData[9]
CuantilesA[2,1] <-CuantilesData[7]; CuantilesA[2,2] <-CuantilesData[10]
CuantilesA[3,1] <-CuantilesData[6]; CuantilesA[3,2] <-CuantilesData[11]
CuantilesA[4,1] <-CuantilesData[5]; CuantilesA[4,2] <-CuantilesData[12]
CuantilesA[5,1] <-CuantilesData[4]; CuantilesA[5,2] <-CuantilesData[13]
CuantilesA[6,1] <-CuantilesData[3]; CuantilesA[6,2] <-CuantilesData[14]
CuantilesA[7,1] <-CuantilesData[2]; CuantilesA[7,2] <-CuantilesData[15]
CuantilesA[8,1] <-CuantilesData[1]; CuantilesA[8,2] <-CuantilesData[16]
CuantilesD[1,1] <-Cuantilillos[8];  CuantilesD[1,2] <-Cuantilillos[9]
CuantilesD[2,1] <-Cuantilillos[7];  CuantilesD[2,2] <-Cuantilillos[10]
CuantilesD[3,1] <-Cuantilillos[6];  CuantilesD[3,2] <-Cuantilillos[11]
CuantilesD[4,1] <-Cuantilillos[5];  CuantilesD[4,2] <-Cuantilillos[12]
CuantilesD[5,1] <-Cuantilillos[4];  CuantilesD[5,2] <-Cuantilillos[13]
CuantilesD[6,1] <-Cuantilillos[3];  CuantilesD[6,2] <-Cuantilillos[14]
CuantilesD[7,1] <-Cuantilillos[2];  CuantilesD[7,2] <-Cuantilillos[15]
CuantilesD[8,1] <-Cuantilillos[1];  CuantilesD[8,2] <-Cuantilillos[16]

print(CuantilesD)
##        LimInf    LimSup
## 65 -0.9345893 0.9345893
## 70 -1.0364334 1.0364334
## 75 -1.1503494 1.1503494
## 80 -1.2815516 1.2815516
## 85 -1.4395315 1.4395315
## 90 -1.6448536 1.6448536
## 95 -1.9599640 1.9599640
## 99 -2.5758293 2.5758293
print(CuantilesA)
##        LimInf    LimSup
## 65 -0.8686609 0.8470080
## 70 -0.9130056 0.9828038
## 75 -0.9619944 1.1403896
## 80 -1.0786897 1.3709267
## 85 -1.1501384 1.7083438
## 90 -1.2344905 2.1268598
## 95 -1.4696481 2.5248146
## 99 -1.9645312 3.0956436
col_sequence <- rainbow(n = 7, alpha = 0.35, start = 0, end = 1)
par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2 pEhEx - DATA (sample 2)', lty = 9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[2,1], lty=2, col="darkblue"); # 70% INFERIOR
abline(v=CuantilesA[2,2], lty=2, col="darkblue") # 70% SUPERIOR
abline(v=CuantilesA[3,1], lty=2, col="aquamarine4"); # 75% INFERIOR
abline(v=CuantilesA[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesA[5,1], lty=2, col="brown"); # 85% INFERIOR
abline(v=CuantilesA[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesA[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesA[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesA[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesA[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesA[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesA[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2   pEhEx - ADJUSTED (sample 2)', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[2,1], lty=2, col="darkblue");  # 70% INFERIOR
abline(v=CuantilesD[2,2], lty=2, col="darkblue"); # 70% SUPERIOR
abline(v=CuantilesD[3,1], lty=2, col="aquamarine4");  # 75% INFERIOR
abline(v=CuantilesD[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesD[5,1], lty=2, col="brown");  # 85% INFERIOR
abline(v=CuantilesD[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesD[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesD[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesD[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesD[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesD[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesD[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))

Grafica Cuantiles del \(65\%\) y \(80\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2  pEhEx - DATA (sample 2)', lty=9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2  BaseMean - ADJUSTED (sample 2)', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))

Grafica Cuantiles del \(70\%\) y \(85\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence, 
     main = 'Normalized Log2 pEhEx - DATA (sample 2)', lty=9)

abline(v=CuantilesA[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesA[2,2], lty=2, col="darkblue")
abline(v=CuantilesA[5,1], lty=2, col="brown"); 
abline(v=CuantilesA[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2  pEhEx - ADJUSTED (sample 2)', lty=9)

abline(v=CuantilesD[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesD[2,2], lty=2, col="darkblue")
abline(v=CuantilesD[5,1], lty=2, col="brown"); 
abline(v=CuantilesD[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))

Muestra 3

log2sample3 <- data3$log2sample3; head(mean(log2sample3)); head(sd(log2sample3))
## [1] 5.944632
## [1] 3.109086
head(log2sample3,5)
## [1]  8.518207  4.937637 10.664720  8.978529  5.301232
ndata3    <- length(log2sample3)
hist(log2sample3, breaks = nbreaks, col= rainbow(25,0.3), 
     main = 'Log2 sample2')

meanlog2sample3 <- mean(log2sample3); head(meanlog2sample3)
## [1] 5.944632
StdDevlog2sample3 <- sd(log2sample3); head(StdDevlog2sample3)
## [1] 3.109086
Normlog2sample3 <- (log2sample3-meanlog2sample3)/StdDevlog2sample3; head(Normlog2sample3)
## [1]  0.8277593 -0.3238879  1.5181592  0.9758164 -0.2069419 -0.1136159
tst<- Normlog2sample3
hist(tst, breaks = nbreaks, col= 1:5, 
     main = 'Normalized Log2sample1',
     xlab='pEhEx1',
     ylab= 'Frequency pEhEx')

Ajustando Modelos

fw1<-fitdist(tst, "norm")
plotdist(tst, histo = TRUE, demp = TRUE)

nnorm.f <- fitdist(tst,"norm")
summary(nnorm.f)
## Fitting of the distribution ' norm ' by maximum likelihood 
## Parameters : 
##           estimate Std. Error
## mean -1.038159e-17 0.01460516
## sd    9.998933e-01 0.01032736
## Loglikelihood:  -6650.065   AIC:  13304.13   BIC:  13317.03 
## Correlation matrix:
##              mean           sd
## mean 1.000000e+00 1.714769e-11
## sd   1.714769e-11 1.000000e+00
par(mfrow=c(2,2))
denscomp(nnorm.f,legendtext = 'Dist Normal')
qqcomp(nnorm.f,legendtext = 'Dist Normal')
cdfcomp(nnorm.f,legendtext = 'Dist Normal')
ppcomp(nnorm.f,legendtext = 'Dist Normal')

probs <- c();
probs[8] = 0.175;  probs[9] = 0.825; 
probs[7] = 0.15;   probs[10] = 0.85;   
probs[6] = 0.125;  probs[11] = 0.875; 
probs[5] = 0.1;    probs[12] = 0.9;    
probs[4] = 0.075;  probs[13] = 0.925; 
probs[3] = 0.05;   probs[14] = 0.95;   
probs[2] = 0.025;  probs[15] = 0.975; 
probs[1] = 0.005;  probs[16] = 0.995;  
CuantilesData <- quantile(tst,prob = probs)
CuantilesModel <- qnorm(probs, mean=0, sd=1)
Cuantilillos <- t(CuantilesModel)
colnames(Cuantilillos) <- c('0.5%','2.5%','5%','7.5%',
                            '10%','12.5%','15%','17.5%',
                            '82.5%','85%','87.5%','90%',
                            '92.5%','95%','97.5%','99.5%')
Cuantilillos <- t(Cuantilillos)
colnames(Cuantilillos) <- c('Cuantiles Ajuste')
print(Cuantilillos)
##       Cuantiles Ajuste
## 0.5%        -2.5758293
## 2.5%        -1.9599640
## 5%          -1.6448536
## 7.5%        -1.4395315
## 10%         -1.2815516
## 12.5%       -1.1503494
## 15%         -1.0364334
## 17.5%       -0.9345893
## 82.5%        0.9345893
## 85%          1.0364334
## 87.5%        1.1503494
## 90%          1.2815516
## 92.5%        1.4395315
## 95%          1.6448536
## 97.5%        1.9599640
## 99.5%        2.5758293
CuantilesA <- matrix(0,8,2)
CuantilesD <- matrix(0,8,2)
colnames(CuantilesA) <- c('LimInf','LimSup')
colnames(CuantilesD) <- c('LimInf','LimSup')
rownames(CuantilesA) <- c('65','70','75','80','85','90','95','99')
rownames(CuantilesD) <- c('65','70','75','80','85','90','95','99')
CuantilesA[1,1] <-CuantilesData[8]; CuantilesA[1,2] <-CuantilesData[9]
CuantilesA[2,1] <-CuantilesData[7]; CuantilesA[2,2] <-CuantilesData[10]
CuantilesA[3,1] <-CuantilesData[6]; CuantilesA[3,2] <-CuantilesData[11]
CuantilesA[4,1] <-CuantilesData[5]; CuantilesA[4,2] <-CuantilesData[12]
CuantilesA[5,1] <-CuantilesData[4]; CuantilesA[5,2] <-CuantilesData[13]
CuantilesA[6,1] <-CuantilesData[3]; CuantilesA[6,2] <-CuantilesData[14]
CuantilesA[7,1] <-CuantilesData[2]; CuantilesA[7,2] <-CuantilesData[15]
CuantilesA[8,1] <-CuantilesData[1]; CuantilesA[8,2] <-CuantilesData[16]
CuantilesD[1,1] <-Cuantilillos[8];  CuantilesD[1,2] <-Cuantilillos[9]
CuantilesD[2,1] <-Cuantilillos[7];  CuantilesD[2,2] <-Cuantilillos[10]
CuantilesD[3,1] <-Cuantilillos[6];  CuantilesD[3,2] <-Cuantilillos[11]
CuantilesD[4,1] <-Cuantilillos[5];  CuantilesD[4,2] <-Cuantilillos[12]
CuantilesD[5,1] <-Cuantilillos[4];  CuantilesD[5,2] <-Cuantilillos[13]
CuantilesD[6,1] <-Cuantilillos[3];  CuantilesD[6,2] <-Cuantilillos[14]
CuantilesD[7,1] <-Cuantilillos[2];  CuantilesD[7,2] <-Cuantilillos[15]
CuantilesD[8,1] <-Cuantilillos[1];  CuantilesD[8,2] <-Cuantilillos[16]
print(CuantilesD)
##        LimInf    LimSup
## 65 -0.9345893 0.9345893
## 70 -1.0364334 1.0364334
## 75 -1.1503494 1.1503494
## 80 -1.2815516 1.2815516
## 85 -1.4395315 1.4395315
## 90 -1.6448536 1.6448536
## 95 -1.9599640 1.9599640
## 99 -2.5758293 2.5758293
print(CuantilesA)
##        LimInf   LimSup
## 65 -0.8804873 0.835306
## 70 -0.9392233 0.967202
## 75 -1.0441669 1.113353
## 80 -1.1800004 1.329308
## 85 -1.2993075 1.626575
## 90 -1.3728657 2.029023
## 95 -1.5681818 2.501518
## 99 -1.9120192 3.109798

Creación de histogramas

col_sequence <- rainbow(n = 7, alpha = 0.35, start = 0, end = 1)
par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2 pEhEx - DATA (sample 3)', lty = 9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[2,1], lty=2, col="darkblue"); # 70% INFERIOR
abline(v=CuantilesA[2,2], lty=2, col="darkblue") # 70% SUPERIOR
abline(v=CuantilesA[3,1], lty=2, col="aquamarine4"); # 75% INFERIOR
abline(v=CuantilesA[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesA[5,1], lty=2, col="brown"); # 85% INFERIOR
abline(v=CuantilesA[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesA[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesA[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesA[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesA[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesA[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesA[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2   pEhEx - ADJUSTED (sample 3)', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[2,1], lty=2, col="darkblue");  # 70% INFERIOR
abline(v=CuantilesD[2,2], lty=2, col="darkblue"); # 70% SUPERIOR
abline(v=CuantilesD[3,1], lty=2, col="aquamarine4");  # 75% INFERIOR
abline(v=CuantilesD[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesD[5,1], lty=2, col="brown");  # 85% INFERIOR
abline(v=CuantilesD[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesD[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesD[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesD[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesD[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesD[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesD[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))

Grafica Cuantiles del \(65\%\) y \(80\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2  pEhEx - DATA (sample 2)', lty=9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2  BaseMean - ADJUSTED (sample 3)', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))

Grafica Cuantiles del \(70\%\) y \(85\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence, 
     main = 'Normalized Log2 pEhEx - DATA (sample 3)', lty=9)

abline(v=CuantilesA[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesA[2,2], lty=2, col="darkblue")
abline(v=CuantilesA[5,1], lty=2, col="brown"); 
abline(v=CuantilesA[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2  pEhEx - ADJUSTED (sample 3)', lty=9)

abline(v=CuantilesD[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesD[2,2], lty=2, col="darkblue")
abline(v=CuantilesD[5,1], lty=2, col="brown"); 
abline(v=CuantilesD[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))

Muestra pEhExvsCDC51

log2vsCDC51 <- data3$log2samplevsCDC51; head(mean(log2vsCDC51)); head(sd(log2vsCDC51))
## [1] 6.079067
## [1] 3.007873
head(log2vsCDC51,5)
## [1] 6.148284 7.761948 9.734356 8.694507 6.367768
ndata3    <- length(log2vsCDC51)
hist(log2vsCDC51, breaks = nbreaks, col= rainbow(25,0.3), 
     main = 'Log2vsCDC51')

meanlog2vsCDC51 <- mean(log2vsCDC51); head(meanlog2vsCDC51)
## [1] 6.079067
StdDevlog2vsCDC51 <- sd(log2vsCDC51); head(StdDevlog2vsCDC51)
## [1] 3.007873
Normlog2vsCDC51 <- (log2vsCDC51-meanlog2vsCDC51)/StdDevlog2vsCDC51; head(Normlog2vsCDC51)
## [1]  0.02301208  0.55949211  1.21524037  0.86953116  0.09598182 -0.29092372
tst<- Normlog2vsCDC51

Primer histograma

hist(tst, breaks = nbreaks, col= 1:5, 
     main = 'Normalized Log2vsCDC51',
     xlab='pEhEx1',
     ylab= 'Frequency pEhEx')

Ajustando modelo

fw1<-fitdist(tst, "norm")
plotdist(tst, histo = TRUE, demp = TRUE)

nnorm.f <- fitdist(tst,"norm")
summary(nnorm.f)
## Fitting of the distribution ' norm ' by maximum likelihood 
## Parameters : 
##          estimate Std. Error
## mean 3.734449e-17 0.01460516
## sd   9.998933e-01 0.01032736
## Loglikelihood:  -6650.065   AIC:  13304.13   BIC:  13317.03 
## Correlation matrix:
##               mean            sd
## mean  1.000000e+00 -3.429538e-11
## sd   -3.429538e-11  1.000000e+00
par(mfrow=c(2,2))
denscomp(nnorm.f,legendtext = 'Dist Normal')
qqcomp(nnorm.f,legendtext = 'Dist Normal')
cdfcomp(nnorm.f,legendtext = 'Dist Normal')
ppcomp(nnorm.f,legendtext = 'Dist Normal')

probs <- c();
probs[8] = 0.175;  probs[9] = 0.825; 
probs[7] = 0.15;   probs[10] = 0.85;   
probs[6] = 0.125;  probs[11] = 0.875; 
probs[5] = 0.1;    probs[12] = 0.9;    
probs[4] = 0.075;  probs[13] = 0.925; 
probs[3] = 0.05;   probs[14] = 0.95;   
probs[2] = 0.025;  probs[15] = 0.975; 
probs[1] = 0.005;  probs[16] = 0.995;  
CuantilesData <- quantile(tst,prob = probs)
CuantilesModel <- qnorm(probs, mean=0, sd=1)
Cuantilillos <- t(CuantilesModel)
colnames(Cuantilillos) <- c('0.5%','2.5%','5%','7.5%',
                            '10%','12.5%','15%','17.5%',
                            '82.5%','85%','87.5%','90%',
                            '92.5%','95%','97.5%','99.5%')
Cuantilillos <- t(Cuantilillos)
colnames(Cuantilillos) <- c('Cuantiles Ajuste')
print(Cuantilillos)
##       Cuantiles Ajuste
## 0.5%        -2.5758293
## 2.5%        -1.9599640
## 5%          -1.6448536
## 7.5%        -1.4395315
## 10%         -1.2815516
## 12.5%       -1.1503494
## 15%         -1.0364334
## 17.5%       -0.9345893
## 82.5%        0.9345893
## 85%          1.0364334
## 87.5%        1.1503494
## 90%          1.2815516
## 92.5%        1.4395315
## 95%          1.6448536
## 97.5%        1.9599640
## 99.5%        2.5758293
CuantilesA <- matrix(0,8,2)
CuantilesD <- matrix(0,8,2)
colnames(CuantilesA) <- c('LimInf','LimSup')
colnames(CuantilesD) <- c('LimInf','LimSup')
rownames(CuantilesA) <- c('65','70','75','80','85','90','95','99')
rownames(CuantilesD) <- c('65','70','75','80','85','90','95','99')
CuantilesA[1,1] <-CuantilesData[8]; CuantilesA[1,2] <-CuantilesData[9]
CuantilesA[2,1] <-CuantilesData[7]; CuantilesA[2,2] <-CuantilesData[10]
CuantilesA[3,1] <-CuantilesData[6]; CuantilesA[3,2] <-CuantilesData[11]
CuantilesA[4,1] <-CuantilesData[5]; CuantilesA[4,2] <-CuantilesData[12]
CuantilesA[5,1] <-CuantilesData[4]; CuantilesA[5,2] <-CuantilesData[13]
CuantilesA[6,1] <-CuantilesData[3]; CuantilesA[6,2] <-CuantilesData[14]
CuantilesA[7,1] <-CuantilesData[2]; CuantilesA[7,2] <-CuantilesData[15]
CuantilesA[8,1] <-CuantilesData[1]; CuantilesA[8,2] <-CuantilesData[16]
CuantilesD[1,1] <-Cuantilillos[8];  CuantilesD[1,2] <-Cuantilillos[9]
CuantilesD[2,1] <-Cuantilillos[7];  CuantilesD[2,2] <-Cuantilillos[10]
CuantilesD[3,1] <-Cuantilillos[6];  CuantilesD[3,2] <-Cuantilillos[11]
CuantilesD[4,1] <-Cuantilillos[5];  CuantilesD[4,2] <-Cuantilillos[12]
CuantilesD[5,1] <-Cuantilillos[4];  CuantilesD[5,2] <-Cuantilillos[13]
CuantilesD[6,1] <-Cuantilillos[3];  CuantilesD[6,2] <-Cuantilillos[14]
CuantilesD[7,1] <-Cuantilillos[2];  CuantilesD[7,2] <-Cuantilillos[15]
CuantilesD[8,1] <-Cuantilillos[1];  CuantilesD[8,2] <-Cuantilillos[16]
print(CuantilesD)
##        LimInf    LimSup
## 65 -0.9345893 0.9345893
## 70 -1.0364334 1.0364334
## 75 -1.1503494 1.1503494
## 80 -1.2815516 1.2815516
## 85 -1.4395315 1.4395315
## 90 -1.6448536 1.6448536
## 95 -1.9599640 1.9599640
## 99 -2.5758293 2.5758293
print(CuantilesA)
##        LimInf    LimSup
## 65 -0.8769970 0.8328201
## 70 -0.9183158 0.9594611
## 75 -0.9635325 1.1254243
## 80 -1.0134598 1.3759593
## 85 -1.0691946 1.6825955
## 90 -1.2049095 2.1281103
## 95 -1.3948811 2.6187546
## 99 -2.0210515 3.1616174

Histogramas

col_sequence <- rainbow(n = 7, alpha = 0.35, start = 0, end = 1)
par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC51 pEhEx - DATA', lty = 9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[2,1], lty=2, col="darkblue"); # 70% INFERIOR
abline(v=CuantilesA[2,2], lty=2, col="darkblue") # 70% SUPERIOR
abline(v=CuantilesA[3,1], lty=2, col="aquamarine4"); # 75% INFERIOR
abline(v=CuantilesA[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesA[5,1], lty=2, col="brown"); # 85% INFERIOR
abline(v=CuantilesA[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesA[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesA[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesA[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesA[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesA[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesA[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC51   pEhEx - ADJUSTED', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[2,1], lty=2, col="darkblue");  # 70% INFERIOR
abline(v=CuantilesD[2,2], lty=2, col="darkblue"); # 70% SUPERIOR
abline(v=CuantilesD[3,1], lty=2, col="aquamarine4");  # 75% INFERIOR
abline(v=CuantilesD[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesD[5,1], lty=2, col="brown");  # 85% INFERIOR
abline(v=CuantilesD[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesD[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesD[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesD[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesD[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesD[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesD[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))

Grafica Cuantiles del \(65\%\) y \(80\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC51  pEhEx - DATA', lty=9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC51  - ADJUSTED', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))

Grafica Cuantiles del \(70\%\) y \(85\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence, 
     main = 'Normalized Log2vsCDC51 pEhEx - DATA', lty=9)

abline(v=CuantilesA[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesA[2,2], lty=2, col="darkblue")
abline(v=CuantilesA[5,1], lty=2, col="brown"); 
abline(v=CuantilesA[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC51  pEhEx - ADJUSTED', lty=9)

abline(v=CuantilesD[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesD[2,2], lty=2, col="darkblue")
abline(v=CuantilesD[5,1], lty=2, col="brown"); 
abline(v=CuantilesD[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))

Muestra pEhExvsCDC52

log2vsCDC52 <- data3$log2samplevsCDC52; head(mean(log2vsCDC52)); head(sd(log2vsCDC52))
## [1] 6.08571
## [1] 2.815509
head(log2vsCDC52,5)
## [1] 5.958700 4.897100 8.935610 9.270150 6.292638

Primer Histograma

ndata3    <- length(log2vsCDC52)
hist(log2vsCDC52, breaks = nbreaks, col= rainbow(25,0.3), 
     main = 'Log2vsCDC52')

meanlog2vsCDC52 <- mean(log2vsCDC52); head(meanlog2vsCDC52)
## [1] 6.08571
StdDevlog2vsCDC52 <- sd(log2vsCDC52); head(StdDevlog2vsCDC52)
## [1] 2.815509
Normlog2vsCDC52 <- (log2vsCDC52-meanlog2vsCDC52)/StdDevlog2vsCDC52; head(Normlog2vsCDC52)
## [1] -0.04511077 -0.42216506  1.01221485  1.13103560  0.07349607 -0.16110183
tst<- Normlog2vsCDC52

** Segundo Histograma**

hist(tst, breaks = nbreaks, col= 1:5, 
     main = 'Normalized Log2vsCDC52',
     xlab='pEhEx1',
     ylab= 'Frequency pEhEx')

Ajustando modelo

fw1<-fitdist(tst, "norm")
plotdist(tst, histo = TRUE, demp = TRUE)

nnorm.f <- fitdist(tst,"norm")
summary(nnorm.f)
## Fitting of the distribution ' norm ' by maximum likelihood 
## Parameters : 
##          estimate Std. Error
## mean 7.844575e-18 0.01460516
## sd   9.998933e-01 0.01032736
## Loglikelihood:  -6650.065   AIC:  13304.13   BIC:  13317.03 
## Correlation matrix:
##      mean sd
## mean    1  0
## sd      0  1
par(mfrow=c(2,2))
denscomp(nnorm.f,legendtext = 'Dist Normal')
qqcomp(nnorm.f,legendtext = 'Dist Normal')
cdfcomp(nnorm.f,legendtext = 'Dist Normal')
ppcomp(nnorm.f,legendtext = 'Dist Normal')

Cálculo de cuantiles

probs <- c();
probs[8] = 0.175;  probs[9] = 0.825; 
probs[7] = 0.15;   probs[10] = 0.85;   
probs[6] = 0.125;  probs[11] = 0.875; 
probs[5] = 0.1;    probs[12] = 0.9;    
probs[4] = 0.075;  probs[13] = 0.925; 
probs[3] = 0.05;   probs[14] = 0.95;   
probs[2] = 0.025;  probs[15] = 0.975; 
probs[1] = 0.005;  probs[16] = 0.995;  
CuantilesData <- quantile(tst,prob = probs)
CuantilesModel <- qnorm(probs, mean=0, sd=1)
Cuantilillos <- t(CuantilesModel)
colnames(Cuantilillos) <- c('0.5%','2.5%','5%','7.5%',
                            '10%','12.5%','15%','17.5%',
                            '82.5%','85%','87.5%','90%',
                            '92.5%','95%','97.5%','99.5%')
Cuantilillos <- t(Cuantilillos)
colnames(Cuantilillos) <- c('Cuantiles Ajuste')
print(Cuantilillos)
##       Cuantiles Ajuste
## 0.5%        -2.5758293
## 2.5%        -1.9599640
## 5%          -1.6448536
## 7.5%        -1.4395315
## 10%         -1.2815516
## 12.5%       -1.1503494
## 15%         -1.0364334
## 17.5%       -0.9345893
## 82.5%        0.9345893
## 85%          1.0364334
## 87.5%        1.1503494
## 90%          1.2815516
## 92.5%        1.4395315
## 95%          1.6448536
## 97.5%        1.9599640
## 99.5%        2.5758293
CuantilesA <- matrix(0,8,2)
CuantilesD <- matrix(0,8,2)
colnames(CuantilesA) <- c('LimInf','LimSup')
colnames(CuantilesD) <- c('LimInf','LimSup')
rownames(CuantilesA) <- c('65','70','75','80','85','90','95','99')
rownames(CuantilesD) <- c('65','70','75','80','85','90','95','99')
CuantilesA[1,1] <-CuantilesData[8]; CuantilesA[1,2] <-CuantilesData[9]
CuantilesA[2,1] <-CuantilesData[7]; CuantilesA[2,2] <-CuantilesData[10]
CuantilesA[3,1] <-CuantilesData[6]; CuantilesA[3,2] <-CuantilesData[11]
CuantilesA[4,1] <-CuantilesData[5]; CuantilesA[4,2] <-CuantilesData[12]
CuantilesA[5,1] <-CuantilesData[4]; CuantilesA[5,2] <-CuantilesData[13]
CuantilesA[6,1] <-CuantilesData[3]; CuantilesA[6,2] <-CuantilesData[14]
CuantilesA[7,1] <-CuantilesData[2]; CuantilesA[7,2] <-CuantilesData[15]
CuantilesA[8,1] <-CuantilesData[1]; CuantilesA[8,2] <-CuantilesData[16]
CuantilesD[1,1] <-Cuantilillos[8];  CuantilesD[1,2] <-Cuantilillos[9]
CuantilesD[2,1] <-Cuantilillos[7];  CuantilesD[2,2] <-Cuantilillos[10]
CuantilesD[3,1] <-Cuantilillos[6];  CuantilesD[3,2] <-Cuantilillos[11]
CuantilesD[4,1] <-Cuantilillos[5];  CuantilesD[4,2] <-Cuantilillos[12]
CuantilesD[5,1] <-Cuantilillos[4];  CuantilesD[5,2] <-Cuantilillos[13]
CuantilesD[6,1] <-Cuantilillos[3];  CuantilesD[6,2] <-Cuantilillos[14]
CuantilesD[7,1] <-Cuantilillos[2];  CuantilesD[7,2] <-Cuantilillos[15]
CuantilesD[8,1] <-Cuantilillos[1];  CuantilesD[8,2] <-Cuantilillos[16]
print(CuantilesD)
##        LimInf    LimSup
## 65 -0.9345893 0.9345893
## 70 -1.0364334 1.0364334
## 75 -1.1503494 1.1503494
## 80 -1.2815516 1.2815516
## 85 -1.4395315 1.4395315
## 90 -1.6448536 1.6448536
## 95 -1.9599640 1.9599640
## 99 -2.5758293 2.5758293
print(CuantilesA)
##        LimInf    LimSup
## 65 -0.8241172 0.7977969
## 70 -0.8968636 0.9352333
## 75 -0.9375162 1.0847564
## 80 -0.9816741 1.3463833
## 85 -1.0299993 1.6629255
## 90 -1.0833612 2.1783677
## 95 -1.2880076 2.7298034
## 99 -2.1614954 3.4267131

Histogramas

col_sequence <- rainbow(n = 7, alpha = 0.35, start = 0, end = 1)
par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC52 pEhEx - DATA', lty = 9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[2,1], lty=2, col="darkblue"); # 70% INFERIOR
abline(v=CuantilesA[2,2], lty=2, col="darkblue") # 70% SUPERIOR
abline(v=CuantilesA[3,1], lty=2, col="aquamarine4"); # 75% INFERIOR
abline(v=CuantilesA[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesA[5,1], lty=2, col="brown"); # 85% INFERIOR
abline(v=CuantilesA[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesA[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesA[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesA[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesA[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesA[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesA[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC52   pEhEx - ADJUSTED', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[2,1], lty=2, col="darkblue");  # 70% INFERIOR
abline(v=CuantilesD[2,2], lty=2, col="darkblue"); # 70% SUPERIOR
abline(v=CuantilesD[3,1], lty=2, col="aquamarine4");  # 75% INFERIOR
abline(v=CuantilesD[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesD[5,1], lty=2, col="brown");  # 85% INFERIOR
abline(v=CuantilesD[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesD[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesD[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesD[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesD[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesD[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesD[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))

Grafica Cuantiles del \(65\%\) y \(80\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC52  pEhEx - DATA', lty=9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC52  - ADJUSTED', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))

Grafica Cuantiles del \(70\%\) y \(85\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence, 
     main = 'Normalized Log2vsCDC52 pEhEx - DATA', lty=9)

abline(v=CuantilesA[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesA[2,2], lty=2, col="darkblue")
abline(v=CuantilesA[5,1], lty=2, col="brown"); 
abline(v=CuantilesA[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC52  pEhEx - ADJUSTED', lty=9)

abline(v=CuantilesD[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesD[2,2], lty=2, col="darkblue")
abline(v=CuantilesD[5,1], lty=2, col="brown"); 
abline(v=CuantilesD[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))

Muestra pEhExvsCDC53

log2vsCDC53 <- data3$log2samplevsCDC53; head(mean(log2vsCDC53)); head(sd(log2vsCDC53))
## [1] 6.068265
## [1] 3.43608
head(log2vsCDC53,5)
## [1]  8.973661  6.062920 13.594055 10.849314  9.017968
ndata3    <- length(log2vsCDC53)

** Primer histograma**

hist(log2vsCDC53, breaks = nbreaks, col= rainbow(25,0.3), 
     main = 'Log2vsCDC53')

meanlog2vsCDC53 <- mean(log2vsCDC53); head(meanlog2vsCDC53)
## [1] 6.068265
StdDevlog2vsCDC53 <- sd(log2vsCDC53); head(StdDevlog2vsCDC53)
## [1] 3.43608
Normlog2vsCDC53 <- (log2vsCDC53-meanlog2vsCDC53)/StdDevlog2vsCDC53; head(Normlog2vsCDC53)
## [1]  0.845555235 -0.001555479  2.190225383  1.391425525  0.858449916
## [6] -0.042916597
tst<- Normlog2vsCDC53

Segundo histograma

hist(tst, breaks = nbreaks, col= 1:5, 
     main = 'Normalized Log2vsCDC53',
     xlab='pEhEx1',
     ylab= 'Frequency pEhEx')

Ajustando modelo

fw1<-fitdist(tst, "norm")
plotdist(tst, histo = TRUE, demp = TRUE)

nnorm.f <- fitdist(tst,"norm")
summary(nnorm.f)
## Fitting of the distribution ' norm ' by maximum likelihood 
## Parameters : 
##           estimate Std. Error
## mean -1.107054e-16 0.01460516
## sd    9.998933e-01 0.01032736
## Loglikelihood:  -6650.065   AIC:  13304.13   BIC:  13317.03 
## Correlation matrix:
##              mean           sd
## mean 1.000000e+00 1.714769e-11
## sd   1.714769e-11 1.000000e+00
par(mfrow=c(2,2))
denscomp(nnorm.f,legendtext = 'Dist Normal')
qqcomp(nnorm.f,legendtext = 'Dist Normal')
cdfcomp(nnorm.f,legendtext = 'Dist Normal')
ppcomp(nnorm.f,legendtext = 'Dist Normal')

Calculo de cuantiles

probs <- c();
probs[8] = 0.175;  probs[9] = 0.825; 
probs[7] = 0.15;   probs[10] = 0.85;   
probs[6] = 0.125;  probs[11] = 0.875; 
probs[5] = 0.1;    probs[12] = 0.9;    
probs[4] = 0.075;  probs[13] = 0.925; 
probs[3] = 0.05;   probs[14] = 0.95;   
probs[2] = 0.025;  probs[15] = 0.975; 
probs[1] = 0.005;  probs[16] = 0.995;  
CuantilesData <- quantile(tst,prob = probs)
CuantilesModel <- qnorm(probs, mean=0, sd=1)
Cuantilillos <- t(CuantilesModel)
colnames(Cuantilillos) <- c('0.5%','2.5%','5%','7.5%',
                            '10%','12.5%','15%','17.5%',
                            '82.5%','85%','87.5%','90%',
                            '92.5%','95%','97.5%','99.5%')
Cuantilillos <- t(Cuantilillos)
colnames(Cuantilillos) <- c('Cuantiles Ajuste')
print(Cuantilillos)
##       Cuantiles Ajuste
## 0.5%        -2.5758293
## 2.5%        -1.9599640
## 5%          -1.6448536
## 7.5%        -1.4395315
## 10%         -1.2815516
## 12.5%       -1.1503494
## 15%         -1.0364334
## 17.5%       -0.9345893
## 82.5%        0.9345893
## 85%          1.0364334
## 87.5%        1.1503494
## 90%          1.2815516
## 92.5%        1.4395315
## 95%          1.6448536
## 97.5%        1.9599640
## 99.5%        2.5758293
CuantilesA <- matrix(0,8,2)
CuantilesD <- matrix(0,8,2)
colnames(CuantilesA) <- c('LimInf','LimSup')
colnames(CuantilesD) <- c('LimInf','LimSup')
rownames(CuantilesA) <- c('65','70','75','80','85','90','95','99')
rownames(CuantilesD) <- c('65','70','75','80','85','90','95','99')
CuantilesA[1,1] <-CuantilesData[8]; CuantilesA[1,2] <-CuantilesData[9]
CuantilesA[2,1] <-CuantilesData[7]; CuantilesA[2,2] <-CuantilesData[10]
CuantilesA[3,1] <-CuantilesData[6]; CuantilesA[3,2] <-CuantilesData[11]
CuantilesA[4,1] <-CuantilesData[5]; CuantilesA[4,2] <-CuantilesData[12]
CuantilesA[5,1] <-CuantilesData[4]; CuantilesA[5,2] <-CuantilesData[13]
CuantilesA[6,1] <-CuantilesData[3]; CuantilesA[6,2] <-CuantilesData[14]
CuantilesA[7,1] <-CuantilesData[2]; CuantilesA[7,2] <-CuantilesData[15]
CuantilesA[8,1] <-CuantilesData[1]; CuantilesA[8,2] <-CuantilesData[16]
CuantilesD[1,1] <-Cuantilillos[8];  CuantilesD[1,2] <-Cuantilillos[9]
CuantilesD[2,1] <-Cuantilillos[7];  CuantilesD[2,2] <-Cuantilillos[10]
CuantilesD[3,1] <-Cuantilillos[6];  CuantilesD[3,2] <-Cuantilillos[11]
CuantilesD[4,1] <-Cuantilillos[5];  CuantilesD[4,2] <-Cuantilillos[12]
CuantilesD[5,1] <-Cuantilillos[4];  CuantilesD[5,2] <-Cuantilillos[13]
CuantilesD[6,1] <-Cuantilillos[3];  CuantilesD[6,2] <-Cuantilillos[14]
CuantilesD[7,1] <-Cuantilillos[2];  CuantilesD[7,2] <-Cuantilillos[15]
CuantilesD[8,1] <-Cuantilillos[1];  CuantilesD[8,2] <-Cuantilillos[16]
print(CuantilesD)
##        LimInf    LimSup
## 65 -0.9345893 0.9345893
## 70 -1.0364334 1.0364334
## 75 -1.1503494 1.1503494
## 80 -1.2815516 1.2815516
## 85 -1.4395315 1.4395315
## 90 -1.6448536 1.6448536
## 95 -1.9599640 1.9599640
## 99 -2.5758293 2.5758293
print(CuantilesA)
##        LimInf    LimSup
## 65 -0.7824916 0.8709604
## 70 -0.9330312 0.9884576
## 75 -1.1699608 1.1455636
## 80 -1.1699608 1.3353109
## 85 -1.1699608 1.5512574
## 90 -1.7660431 1.8682788
## 95 -1.7660431 2.3078117
## 99 -1.7660431 3.1171283

Histogramas

col_sequence <- rainbow(n = 7, alpha = 0.35, start = 0, end = 1)
par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC53 pEhEx - DATA', lty = 9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[2,1], lty=2, col="darkblue"); # 70% INFERIOR
abline(v=CuantilesA[2,2], lty=2, col="darkblue") # 70% SUPERIOR
abline(v=CuantilesA[3,1], lty=2, col="aquamarine4"); # 75% INFERIOR
abline(v=CuantilesA[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesA[5,1], lty=2, col="brown"); # 85% INFERIOR
abline(v=CuantilesA[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesA[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesA[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesA[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesA[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesA[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesA[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC53   pEhEx - ADJUSTED', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[2,1], lty=2, col="darkblue");  # 70% INFERIOR
abline(v=CuantilesD[2,2], lty=2, col="darkblue"); # 70% SUPERIOR
abline(v=CuantilesD[3,1], lty=2, col="aquamarine4");  # 75% INFERIOR
abline(v=CuantilesD[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesD[5,1], lty=2, col="brown");  # 85% INFERIOR
abline(v=CuantilesD[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesD[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesD[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesD[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesD[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesD[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesD[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))

Grafica Cuantiles del \(65\%\) y \(80\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC53  pEhEx - DATA', lty=9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC51  - ADJUSTED', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))

Grafica Cuantiles del \(70\%\) y \(85\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence, 
     main = 'Normalized Log2vsCDC53 pEhEx - DATA', lty=9)

abline(v=CuantilesA[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesA[2,2], lty=2, col="darkblue")
abline(v=CuantilesA[5,1], lty=2, col="brown"); 
abline(v=CuantilesA[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC53  pEhEx - ADJUSTED', lty=9)

abline(v=CuantilesD[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesD[2,2], lty=2, col="darkblue")
abline(v=CuantilesD[5,1], lty=2, col="brown"); 
abline(v=CuantilesD[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))

Cuarta Clasificacion: pEhExvsU2AF84

head(pEhExvsU2AF84,10);
## # A tibble: 10 × 7
##    GenId       CDC5_1 CDC5_2   CDC5_3 pEhEx_1 pEhEx_2 pEhEx_3
##    <chr>        <dbl>  <dbl>    <dbl>   <dbl>   <dbl>   <dbl>
##  1 EHI_000130A   59.6   70.4   611.     140.    347.   382.  
##  2 EHI_000140A  118.   207.     91.9    283.    273.    31.0 
##  3 EHI_000240A  689.   871.  11090.     941.   1550.  1694.  
##  4 EHI_000250A  426.   407.   1608.     260.    262.   526.  
##  5 EHI_000260A  104.   110.    422.      87.3    53.7   40.1 
##  6 EHI_000280A   40.4   35.2   108.      43.9    66.9   49.3 
##  7 EHI_000290A   15.2   19.7    44.8     14.8    11.3   64.8 
##  8 EHI_000300A   74.8   94.2     2.36   107.     92.4   25.2 
##  9 EHI_000410A   15.2   15.5   134.      22.6    19.8   52.2 
## 10 EHI_000430A   18.2   23.8    28.3     20.8    11.3    8.60
nbreaks <- 10
data4 <- pEhExvsU2AF84;       head(data4)
## # A tibble: 6 × 7
##   GenId       CDC5_1 CDC5_2  CDC5_3 pEhEx_1 pEhEx_2 pEhEx_3
##   <chr>        <dbl>  <dbl>   <dbl>   <dbl>   <dbl>   <dbl>
## 1 EHI_000130A   59.6   70.4   611.    140.    347.    382. 
## 2 EHI_000140A  118.   207.     91.9   283.    273.     31.0
## 3 EHI_000240A  689.   871.  11090.    941.   1550.   1694. 
## 4 EHI_000250A  426.   407.   1608.    260.    262.    526. 
## 5 EHI_000260A  104.   110.    422.     87.3    53.7    40.1
## 6 EHI_000280A   40.4   35.2   108.     43.9    66.9    49.3

Log-Normalización

sample1   <- data4$pEhEx_1; sample2   <- data4$pEhEx_2; sample3   <- data4$pEhEx_3;
samplevs1 <- data4$CDC5_1;  samplevs2 <- data4$CDC5_2;  samplevs3 <- data4$CDC5_3;
log2sample1 <- log2(sample1+1);         log2sample2 <- log2(sample2+1)
log2sample3 <- log2(sample3+1);         log2samplevsCDC51 <- log2(samplevs1+1)
log2samplevsCDC52 <- log2(samplevs2+1); log2samplevsCDC53 <- log2(samplevs3+1)
data4 <- cbind(data4, log2sample1,log2sample2,log2sample3,
               log2samplevsCDC51,log2samplevsCDC52,log2samplevsCDC53)
head(data4)
##         GenId    CDC5_1    CDC5_2      CDC5_3   pEhEx_1    pEhEx_2    pEhEx_3
## 1 EHI_000130A  59.61996  70.37838   610.61850 140.16143  346.92628  381.74940
## 2 EHI_000140A 118.22941 206.99523    91.94642 282.69848  273.39300   30.95265
## 3 EHI_000240A 689.16628 871.44992 11090.15226 940.74452 1549.85546 1693.79799
## 4 EHI_000250A 426.43427 406.74563  1607.88347 260.13011  262.08018  525.62192
## 5 EHI_000260A 104.08230 109.70747   422.01047  87.30394   53.73586   40.12381
## 6 EHI_000280A  40.42031  35.18919   108.44962  43.94892   66.93415   49.29497
##   log2sample1 log2sample2 log2sample3 log2samplevsCDC51 log2samplevsCDC52
## 1    7.141202    8.442638    8.580256          5.921721          6.157415
## 2    8.148215    8.100100    4.997864          6.897596          7.700407
## 3    9.879192   10.598849   10.726898          9.430800          9.768929
## 4    8.028625    8.039359    9.040624          8.739559          8.671526
## 5    6.464406    5.774415    5.361902          6.715376          6.790609
## 6    5.490215    6.086065    5.652342          5.372266          5.177487
##   log2samplevsCDC53
## 1          9.256488
## 2          6.538327
## 3         13.437122
## 4         10.651844
## 5          8.724550
## 6          6.774123
save.image('CheckPointFifth.RData')
setwd("~/Documents/GitHub/Resultados/docs/PrimeroDiffExpAllResults/Clasificando/Abundances")
#load('CheckPointTwo.RData')
library(ggplot2);library(dplyr);library("fitdistrplus");
library("MASS");library("survival")
head(data4)
##         GenId    CDC5_1    CDC5_2      CDC5_3   pEhEx_1    pEhEx_2    pEhEx_3
## 1 EHI_000130A  59.61996  70.37838   610.61850 140.16143  346.92628  381.74940
## 2 EHI_000140A 118.22941 206.99523    91.94642 282.69848  273.39300   30.95265
## 3 EHI_000240A 689.16628 871.44992 11090.15226 940.74452 1549.85546 1693.79799
## 4 EHI_000250A 426.43427 406.74563  1607.88347 260.13011  262.08018  525.62192
## 5 EHI_000260A 104.08230 109.70747   422.01047  87.30394   53.73586   40.12381
## 6 EHI_000280A  40.42031  35.18919   108.44962  43.94892   66.93415   49.29497
##   log2sample1 log2sample2 log2sample3 log2samplevsCDC51 log2samplevsCDC52
## 1    7.141202    8.442638    8.580256          5.921721          6.157415
## 2    8.148215    8.100100    4.997864          6.897596          7.700407
## 3    9.879192   10.598849   10.726898          9.430800          9.768929
## 4    8.028625    8.039359    9.040624          8.739559          8.671526
## 5    6.464406    5.774415    5.361902          6.715376          6.790609
## 6    5.490215    6.086065    5.652342          5.372266          5.177487
##   log2samplevsCDC53
## 1          9.256488
## 2          6.538327
## 3         13.437122
## 4         10.651844
## 5          8.724550
## 6          6.774123

Muestra 1

log2sample1 <- data4$log2sample1; head(mean(log2sample1)); head(sd(log2sample1))
## [1] 6.066239
## [1] 2.837457
head(log2sample1,5)
## [1] 7.141202 8.148215 9.879192 8.028625 6.464406
summary(data4)
##     GenId               CDC5_1              CDC5_2              CDC5_3         
##  Length:4746        Min.   :     0.00   Min.   :     0.00   Min.   :      0.0  
##  Class :character   1st Qu.:    15.16   1st Qu.:    14.49   1st Qu.:     14.1  
##  Mode  :character   Median :    41.43   Median :    42.43   Median :     49.5  
##                     Mean   :  1422.93   Mean   :  1431.84   Mean   :   3498.7  
##                     3rd Qu.:   168.75   3rd Qu.:   187.33   3rd Qu.:    237.5  
##                     Max.   :236529.55   Max.   :222485.72   Max.   :1942165.3  
##     pEhEx_1             pEhEx_2             pEhEx_3          log2sample1    
##  Min.   :     0.00   Min.   :     0.00   Min.   :     0.0   Min.   : 0.000  
##  1st Qu.:    14.85   1st Qu.:    13.20   1st Qu.:    12.6   1st Qu.: 3.986  
##  Median :    42.17   Median :    42.42   Median :    44.7   Median : 5.432  
##  Mean   :  1156.92   Mean   :  1454.96   Mean   :  1569.6   Mean   : 6.066  
##  3rd Qu.:   172.68   3rd Qu.:   191.38   3rd Qu.:   199.5   3rd Qu.: 7.440  
##  Max.   :170957.75   Max.   :224129.46   Max.   :578317.1   Max.   :17.383  
##   log2sample2      log2sample3     log2samplevsCDC51 log2samplevsCDC52
##  Min.   : 0.000   Min.   : 0.000   Min.   : 0.000    Min.   : 0.000   
##  1st Qu.: 3.828   1st Qu.: 3.767   1st Qu.: 4.014    1st Qu.: 3.953   
##  Median : 5.440   Median : 5.514   Median : 5.407    Median : 5.441   
##  Mean   : 6.019   Mean   : 5.939   Mean   : 6.074    Mean   : 6.080   
##  3rd Qu.: 7.588   3rd Qu.: 7.647   3rd Qu.: 7.407    3rd Qu.: 7.557   
##  Max.   :17.774   Max.   :19.142   Max.   :17.852    Max.   :17.763   
##  log2samplevsCDC53
##  Min.   : 0.000   
##  1st Qu.: 3.921   
##  Median : 5.658   
##  Mean   : 6.152   
##  3rd Qu.: 7.898   
##  Max.   :20.889
ndata4    <- length(log2sample1)
hist(log2sample1, breaks = nbreaks, col= rainbow(25,0.3), 
     main = 'Log2 sample1')

meanlog2sample1 <- mean(log2sample1); head(meanlog2sample1)
## [1] 6.066239
StdDevlog2sample1 <- sd(log2sample1); head(StdDevlog2sample1)
## [1] 2.837457
Normlog2sample1 <- (log2sample1-meanlog2sample1)/StdDevlog2sample1; head(Normlog2sample1)
## [1]  0.3788472  0.7337468  1.3437920  0.6916001  0.1403251 -0.2030074
tst<- Normlog2sample1

hist(tst, breaks = nbreaks, col= 1:5, 
     main = 'Normalized Log2sample1',
     xlab='pEhEx1',
     ylab= 'Frequency pEhEx')

fw1<-fitdist(tst, "norm")
plotdist(tst, histo = TRUE, demp = TRUE)

nnorm.f <- fitdist(tst,"norm")
summary(nnorm.f)
## Fitting of the distribution ' norm ' by maximum likelihood 
## Parameters : 
##           estimate Std. Error
## mean -5.346355e-17 0.01451411
## sd    9.998946e-01 0.01026298
## Loglikelihood:  -6733.782   AIC:  13471.56   BIC:  13484.49 
## Correlation matrix:
##               mean            sd
## mean  1.000000e+00 -3.386913e-11
## sd   -3.386913e-11  1.000000e+00
par(mfrow=c(2,2))
denscomp(nnorm.f,legendtext = 'Dist Normal')
qqcomp(nnorm.f,legendtext = 'Dist Normal')
cdfcomp(nnorm.f,legendtext = 'Dist Normal')
ppcomp(nnorm.f,legendtext = 'Dist Normal')

probs <- c();
probs[8] = 0.175;  probs[9] = 0.825; 
probs[7] = 0.15;   probs[10] = 0.85;   
probs[6] = 0.125;  probs[11] = 0.875; 
probs[5] = 0.1;    probs[12] = 0.9;    
probs[4] = 0.075;  probs[13] = 0.925; 
probs[3] = 0.05;   probs[14] = 0.95;   
probs[2] = 0.025;  probs[15] = 0.975; 
probs[1] = 0.005;  probs[16] = 0.995;  
CuantilesData <- quantile(tst,prob = probs)
CuantilesModel <- qnorm(probs, mean=0, sd=1)
Cuantilillos <- t(CuantilesModel)
colnames(Cuantilillos) <- c('0.5%','2.5%','5%','7.5%',
                            '10%','12.5%','15%','17.5%',
                            '82.5%','85%','87.5%','90%',
                            '92.5%','95%','97.5%','99.5%')
Cuantilillos <- t(Cuantilillos)
colnames(Cuantilillos) <- c('Cuantiles Ajuste')
print(Cuantilillos)
##       Cuantiles Ajuste
## 0.5%        -2.5758293
## 2.5%        -1.9599640
## 5%          -1.6448536
## 7.5%        -1.4395315
## 10%         -1.2815516
## 12.5%       -1.1503494
## 15%         -1.0364334
## 17.5%       -0.9345893
## 82.5%        0.9345893
## 85%          1.0364334
## 87.5%        1.1503494
## 90%          1.2815516
## 92.5%        1.4395315
## 95%          1.6448536
## 97.5%        1.9599640
## 99.5%        2.5758293

Cálculo de cuantiles

CuantilesA <- matrix(0,8,2)
CuantilesD <- matrix(0,8,2)
colnames(CuantilesA) <- c('LimInf','LimSup')
colnames(CuantilesD) <- c('LimInf','LimSup')
rownames(CuantilesA) <- c('65','70','75','80','85','90','95','99')
rownames(CuantilesD) <- c('65','70','75','80','85','90','95','99')
CuantilesA[1,1] <-CuantilesData[8]; CuantilesA[1,2] <-CuantilesData[9]
CuantilesA[2,1] <-CuantilesData[7]; CuantilesA[2,2] <-CuantilesData[10]
CuantilesA[3,1] <-CuantilesData[6]; CuantilesA[3,2] <-CuantilesData[11]
CuantilesA[4,1] <-CuantilesData[5]; CuantilesA[4,2] <-CuantilesData[12]
CuantilesA[5,1] <-CuantilesData[4]; CuantilesA[5,2] <-CuantilesData[13]
CuantilesA[6,1] <-CuantilesData[3]; CuantilesA[6,2] <-CuantilesData[14]
CuantilesA[7,1] <-CuantilesData[2]; CuantilesA[7,2] <-CuantilesData[15]
CuantilesA[8,1] <-CuantilesData[1]; CuantilesA[8,2] <-CuantilesData[16]
CuantilesD[1,1] <-Cuantilillos[8];  CuantilesD[1,2] <-Cuantilillos[9]
CuantilesD[2,1] <-Cuantilillos[7];  CuantilesD[2,2] <-Cuantilillos[10]
CuantilesD[3,1] <-Cuantilillos[6];  CuantilesD[3,2] <-Cuantilillos[11]
CuantilesD[4,1] <-Cuantilillos[5];  CuantilesD[4,2] <-Cuantilillos[12]
CuantilesD[5,1] <-Cuantilillos[4];  CuantilesD[5,2] <-Cuantilillos[13]
CuantilesD[6,1] <-Cuantilillos[3];  CuantilesD[6,2] <-Cuantilillos[14]
CuantilesD[7,1] <-Cuantilillos[2];  CuantilesD[7,2] <-Cuantilillos[15]
CuantilesD[8,1] <-Cuantilillos[1];  CuantilesD[8,2] <-Cuantilillos[16]
print(CuantilesD)
##        LimInf    LimSup
## 65 -0.9345893 0.9345893
## 70 -1.0364334 1.0364334
## 75 -1.1503494 1.1503494
## 80 -1.2815516 1.2815516
## 85 -1.4395315 1.4395315
## 90 -1.6448536 1.6448536
## 95 -1.9599640 1.9599640
## 99 -2.5758293 2.5758293
print(CuantilesA)
##        LimInf    LimSup
## 65 -0.8625714 0.8124762
## 70 -0.9422460 0.9640896
## 75 -0.9718431 1.1342860
## 80 -1.0367684 1.3790909
## 85 -1.0726303 1.7033941
## 90 -1.1529698 2.1934547
## 95 -1.3038487 2.6233257
## 99 -1.7398510 3.1888833
col_sequence <- rainbow(n = 7, alpha = 0.35, start = 0, end = 1)
par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2 pEhEx - DATA', lty = 9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[2,1], lty=2, col="darkblue"); # 70% INFERIOR
abline(v=CuantilesA[2,2], lty=2, col="darkblue") # 70% SUPERIOR
abline(v=CuantilesA[3,1], lty=2, col="aquamarine4"); # 75% INFERIOR
abline(v=CuantilesA[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesA[5,1], lty=2, col="brown"); # 85% INFERIOR
abline(v=CuantilesA[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesA[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesA[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesA[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesA[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesA[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesA[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2   pEhEx - ADJUSTED', lty=9)
abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[2,1], lty=2, col="darkblue");  # 70% INFERIOR
abline(v=CuantilesD[2,2], lty=2, col="darkblue"); # 70% SUPERIOR
abline(v=CuantilesD[3,1], lty=2, col="aquamarine4");  # 75% INFERIOR
abline(v=CuantilesD[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesD[5,1], lty=2, col="brown");  # 85% INFERIOR
abline(v=CuantilesD[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesD[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesD[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesD[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesD[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesD[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesD[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))

Grafica Cuantiles del \(65\%\) y \(80\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2  pEhEx - DATA', lty=9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2  BaseMean - ADJUSTED', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))

Grafica Cuantiles del \(70\%\) y \(85\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence, 
     main = 'Normalized Log2 pEhEx - DATA', lty=9)

abline(v=CuantilesA[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesA[2,2], lty=2, col="darkblue")
abline(v=CuantilesA[5,1], lty=2, col="brown"); 
abline(v=CuantilesA[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2  pEhEx - ADJUSTED', lty=9)

abline(v=CuantilesD[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesD[2,2], lty=2, col="darkblue")
abline(v=CuantilesD[5,1], lty=2, col="brown"); 
abline(v=CuantilesD[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))

Muestra 2

log2sample2 <- data4$log2sample2; head(mean(log2sample2)); head(sd(log2sample2))
## [1] 6.018835
## [1] 3.085311
head(log2sample2,5)
## [1]  8.442638  8.100100 10.598849  8.039359  5.774415
ndata4    <- length(log2sample2)
hist(log2sample2, breaks = nbreaks, col= rainbow(25,0.3), 
     main = 'Log2 sample2')

Log-normalizacion

meanlog2sample2 <- mean(log2sample2); head(meanlog2sample2)
## [1] 6.018835
StdDevlog2sample2 <- sd(log2sample2); head(StdDevlog2sample2)
## [1] 3.085311
Normlog2sample2 <- (log2sample2-meanlog2sample2)/StdDevlog2sample2; head(Normlog2sample2)
## [1]  0.78559421  0.67457202  1.48445747  0.65488484 -0.07922075  0.02179028
tst<- Normlog2sample2
hist(tst, breaks = nbreaks, col= 1:5, 
     main = 'Normalized Log2sample1',
     xlab='pEhEx1',
     ylab= 'Frequency pEhEx')

Ajuste de modelo

fw1<-fitdist(tst, "norm")
plotdist(tst, histo = TRUE, demp = TRUE)

nnorm.f <- fitdist(tst,"norm")
summary(nnorm.f)
## Fitting of the distribution ' norm ' by maximum likelihood 
## Parameters : 
##          estimate Std. Error
## mean 4.519200e-17 0.01451411
## sd   9.998946e-01 0.01026298
## Loglikelihood:  -6733.782   AIC:  13471.56   BIC:  13484.49 
## Correlation matrix:
##      mean sd
## mean    1  0
## sd      0  1
par(mfrow=c(2,2))
denscomp(nnorm.f,legendtext = 'Dist Normal')
qqcomp(nnorm.f,legendtext = 'Dist Normal')
cdfcomp(nnorm.f,legendtext = 'Dist Normal')
ppcomp(nnorm.f,legendtext = 'Dist Normal')

probs <- c();
probs[8] = 0.175;  probs[9] = 0.825; 
probs[7] = 0.15;   probs[10] = 0.85;   
probs[6] = 0.125;  probs[11] = 0.875; 
probs[5] = 0.1;    probs[12] = 0.9;    
probs[4] = 0.075;  probs[13] = 0.925; 
probs[3] = 0.05;   probs[14] = 0.95;   
probs[2] = 0.025;  probs[15] = 0.975; 
probs[1] = 0.005;  probs[16] = 0.995;  
CuantilesData <- quantile(tst,prob = probs)
CuantilesModel <- qnorm(probs, mean=0, sd=1)
Cuantilillos <- t(CuantilesModel)
colnames(Cuantilillos) <- c('0.5%','2.5%','5%','7.5%',
                            '10%','12.5%','15%','17.5%',
                            '82.5%','85%','87.5%','90%',
                            '92.5%','95%','97.5%','99.5%')
Cuantilillos <- t(Cuantilillos)
colnames(Cuantilillos) <- c('Cuantiles Ajuste')
print(Cuantilillos)
##       Cuantiles Ajuste
## 0.5%        -2.5758293
## 2.5%        -1.9599640
## 5%          -1.6448536
## 7.5%        -1.4395315
## 10%         -1.2815516
## 12.5%       -1.1503494
## 15%         -1.0364334
## 17.5%       -0.9345893
## 82.5%        0.9345893
## 85%          1.0364334
## 87.5%        1.1503494
## 90%          1.2815516
## 92.5%        1.4395315
## 95%          1.6448536
## 97.5%        1.9599640
## 99.5%        2.5758293
CuantilesA <- matrix(0,8,2)
CuantilesD <- matrix(0,8,2)
colnames(CuantilesA) <- c('LimInf','LimSup')
colnames(CuantilesD) <- c('LimInf','LimSup')
rownames(CuantilesA) <- c('65','70','75','80','85','90','95','99')
rownames(CuantilesD) <- c('65','70','75','80','85','90','95','99')
CuantilesA[1,1] <-CuantilesData[8]; CuantilesA[1,2] <-CuantilesData[9]
CuantilesA[2,1] <-CuantilesData[7]; CuantilesA[2,2] <-CuantilesData[10]
CuantilesA[3,1] <-CuantilesData[6]; CuantilesA[3,2] <-CuantilesData[11]
CuantilesA[4,1] <-CuantilesData[5]; CuantilesA[4,2] <-CuantilesData[12]
CuantilesA[5,1] <-CuantilesData[4]; CuantilesA[5,2] <-CuantilesData[13]
CuantilesA[6,1] <-CuantilesData[3]; CuantilesA[6,2] <-CuantilesData[14]
CuantilesA[7,1] <-CuantilesData[2]; CuantilesA[7,2] <-CuantilesData[15]
CuantilesA[8,1] <-CuantilesData[1]; CuantilesA[8,2] <-CuantilesData[16]
CuantilesD[1,1] <-Cuantilillos[8];  CuantilesD[1,2] <-Cuantilillos[9]
CuantilesD[2,1] <-Cuantilillos[7];  CuantilesD[2,2] <-Cuantilillos[10]
CuantilesD[3,1] <-Cuantilillos[6];  CuantilesD[3,2] <-Cuantilillos[11]
CuantilesD[4,1] <-Cuantilillos[5];  CuantilesD[4,2] <-Cuantilillos[12]
CuantilesD[5,1] <-Cuantilillos[4];  CuantilesD[5,2] <-Cuantilillos[13]
CuantilesD[6,1] <-Cuantilillos[3];  CuantilesD[6,2] <-Cuantilillos[14]
CuantilesD[7,1] <-Cuantilillos[2];  CuantilesD[7,2] <-Cuantilillos[15]
CuantilesD[8,1] <-Cuantilillos[1];  CuantilesD[8,2] <-Cuantilillos[16]

print(CuantilesD)
##        LimInf    LimSup
## 65 -0.9345893 0.9345893
## 70 -1.0364334 1.0364334
## 75 -1.1503494 1.1503494
## 80 -1.2815516 1.2815516
## 85 -1.4395315 1.4395315
## 90 -1.6448536 1.6448536
## 95 -1.9599640 1.9599640
## 99 -2.5758293 2.5758293
print(CuantilesA)
##        LimInf    LimSup
## 65 -0.8988548 0.8463966
## 70 -0.9478079 0.9891035
## 75 -1.0024917 1.1467315
## 80 -1.0644280 1.3749391
## 85 -1.1358390 1.6937524
## 90 -1.2201564 2.1241067
## 95 -1.4552922 2.5236980
## 99 -1.9508033 3.0984441
col_sequence <- rainbow(n = 7, alpha = 0.35, start = 0, end = 1)
par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2 pEhEx - DATA (sample 2)', lty = 9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[2,1], lty=2, col="darkblue"); # 70% INFERIOR
abline(v=CuantilesA[2,2], lty=2, col="darkblue") # 70% SUPERIOR
abline(v=CuantilesA[3,1], lty=2, col="aquamarine4"); # 75% INFERIOR
abline(v=CuantilesA[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesA[5,1], lty=2, col="brown"); # 85% INFERIOR
abline(v=CuantilesA[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesA[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesA[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesA[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesA[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesA[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesA[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2   pEhEx - ADJUSTED (sample 2)', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[2,1], lty=2, col="darkblue");  # 70% INFERIOR
abline(v=CuantilesD[2,2], lty=2, col="darkblue"); # 70% SUPERIOR
abline(v=CuantilesD[3,1], lty=2, col="aquamarine4");  # 75% INFERIOR
abline(v=CuantilesD[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesD[5,1], lty=2, col="brown");  # 85% INFERIOR
abline(v=CuantilesD[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesD[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesD[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesD[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesD[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesD[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesD[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))

Grafica Cuantiles del \(65\%\) y \(80\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2  pEhEx - DATA (sample 2)', lty=9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2  BaseMean - ADJUSTED (sample 2)', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))

Grafica Cuantiles del \(70\%\) y \(85\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence, 
     main = 'Normalized Log2 pEhEx - DATA (sample 2)', lty=9)

abline(v=CuantilesA[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesA[2,2], lty=2, col="darkblue")
abline(v=CuantilesA[5,1], lty=2, col="brown"); 
abline(v=CuantilesA[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2  pEhEx - ADJUSTED (sample 2)', lty=9)

abline(v=CuantilesD[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesD[2,2], lty=2, col="darkblue")
abline(v=CuantilesD[5,1], lty=2, col="brown"); 
abline(v=CuantilesD[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))

Muestra 3

log2sample3 <- data4$log2sample3; head(mean(log2sample3)); head(sd(log2sample3))
## [1] 5.938851
## [1] 3.137257
head(log2sample3,5)
## [1]  8.580256  4.997864 10.726898  9.040624  5.361902
ndata4    <- length(log2sample3)
hist(log2sample3, breaks = nbreaks, col= rainbow(25,0.3), 
     main = 'Log2 sample2')

meanlog2sample3 <- mean(log2sample3); head(meanlog2sample3)
## [1] 5.938851
StdDevlog2sample3 <- sd(log2sample3); head(StdDevlog2sample3)
## [1] 3.137257
Normlog2sample3 <- (log2sample3-meanlog2sample3)/StdDevlog2sample3; head(Normlog2sample3)
## [1]  0.84194733 -0.29993956  1.52618884  0.98868937 -0.18390246 -0.09132474
tst<- Normlog2sample3
hist(tst, breaks = nbreaks, col= 1:5, 
     main = 'Normalized Log2sample1',
     xlab='pEhEx1',
     ylab= 'Frequency pEhEx')

Ajustando Modelos

fw1<-fitdist(tst, "norm")
plotdist(tst, histo = TRUE, demp = TRUE)

nnorm.f <- fitdist(tst,"norm")
summary(nnorm.f)
## Fitting of the distribution ' norm ' by maximum likelihood 
## Parameters : 
##          estimate Std. Error
## mean 1.897633e-17 0.01451411
## sd   9.998946e-01 0.01026298
## Loglikelihood:  -6733.782   AIC:  13471.56   BIC:  13484.49 
## Correlation matrix:
##      mean sd
## mean    1  0
## sd      0  1
par(mfrow=c(2,2))
denscomp(nnorm.f,legendtext = 'Dist Normal')
qqcomp(nnorm.f,legendtext = 'Dist Normal')
cdfcomp(nnorm.f,legendtext = 'Dist Normal')
ppcomp(nnorm.f,legendtext = 'Dist Normal')

probs <- c();
probs[8] = 0.175;  probs[9] = 0.825; 
probs[7] = 0.15;   probs[10] = 0.85;   
probs[6] = 0.125;  probs[11] = 0.875; 
probs[5] = 0.1;    probs[12] = 0.9;    
probs[4] = 0.075;  probs[13] = 0.925; 
probs[3] = 0.05;   probs[14] = 0.95;   
probs[2] = 0.025;  probs[15] = 0.975; 
probs[1] = 0.005;  probs[16] = 0.995;  
CuantilesData <- quantile(tst,prob = probs)
CuantilesModel <- qnorm(probs, mean=0, sd=1)
Cuantilillos <- t(CuantilesModel)
colnames(Cuantilillos) <- c('0.5%','2.5%','5%','7.5%',
                            '10%','12.5%','15%','17.5%',
                            '82.5%','85%','87.5%','90%',
                            '92.5%','95%','97.5%','99.5%')
Cuantilillos <- t(Cuantilillos)
colnames(Cuantilillos) <- c('Cuantiles Ajuste')
print(Cuantilillos)
##       Cuantiles Ajuste
## 0.5%        -2.5758293
## 2.5%        -1.9599640
## 5%          -1.6448536
## 7.5%        -1.4395315
## 10%         -1.2815516
## 12.5%       -1.1503494
## 15%         -1.0364334
## 17.5%       -0.9345893
## 82.5%        0.9345893
## 85%          1.0364334
## 87.5%        1.1503494
## 90%          1.2815516
## 92.5%        1.4395315
## 95%          1.6448536
## 97.5%        1.9599640
## 99.5%        2.5758293
CuantilesA <- matrix(0,8,2)
CuantilesD <- matrix(0,8,2)
colnames(CuantilesA) <- c('LimInf','LimSup')
colnames(CuantilesD) <- c('LimInf','LimSup')
rownames(CuantilesA) <- c('65','70','75','80','85','90','95','99')
rownames(CuantilesD) <- c('65','70','75','80','85','90','95','99')
CuantilesA[1,1] <-CuantilesData[8]; CuantilesA[1,2] <-CuantilesData[9]
CuantilesA[2,1] <-CuantilesData[7]; CuantilesA[2,2] <-CuantilesData[10]
CuantilesA[3,1] <-CuantilesData[6]; CuantilesA[3,2] <-CuantilesData[11]
CuantilesA[4,1] <-CuantilesData[5]; CuantilesA[4,2] <-CuantilesData[12]
CuantilesA[5,1] <-CuantilesData[4]; CuantilesA[5,2] <-CuantilesData[13]
CuantilesA[6,1] <-CuantilesData[3]; CuantilesA[6,2] <-CuantilesData[14]
CuantilesA[7,1] <-CuantilesData[2]; CuantilesA[7,2] <-CuantilesData[15]
CuantilesA[8,1] <-CuantilesData[1]; CuantilesA[8,2] <-CuantilesData[16]
CuantilesD[1,1] <-Cuantilillos[8];  CuantilesD[1,2] <-Cuantilillos[9]
CuantilesD[2,1] <-Cuantilillos[7];  CuantilesD[2,2] <-Cuantilillos[10]
CuantilesD[3,1] <-Cuantilillos[6];  CuantilesD[3,2] <-Cuantilillos[11]
CuantilesD[4,1] <-Cuantilillos[5];  CuantilesD[4,2] <-Cuantilillos[12]
CuantilesD[5,1] <-Cuantilillos[4];  CuantilesD[5,2] <-Cuantilillos[13]
CuantilesD[6,1] <-Cuantilillos[3];  CuantilesD[6,2] <-Cuantilillos[14]
CuantilesD[7,1] <-Cuantilillos[2];  CuantilesD[7,2] <-Cuantilillos[15]
CuantilesD[8,1] <-Cuantilillos[1];  CuantilesD[8,2] <-Cuantilillos[16]
print(CuantilesD)
##        LimInf    LimSup
## 65 -0.9345893 0.9345893
## 70 -1.0364334 1.0364334
## 75 -1.1503494 1.1503494
## 80 -1.2815516 1.2815516
## 85 -1.4395315 1.4395315
## 90 -1.6448536 1.6448536
## 95 -1.9599640 1.9599640
## 99 -2.5758293 2.5758293
print(CuantilesA)
##        LimInf    LimSup
## 65 -0.8813312 0.8377086
## 70 -0.9785407 0.9709584
## 75 -1.0570406 1.1167404
## 80 -1.1517563 1.3292508
## 85 -1.2711789 1.6268787
## 90 -1.4329274 2.0299674
## 95 -1.5417724 2.4960043
## 99 -1.8930077 3.1029256

Creación de histogramas

col_sequence <- rainbow(n = 7, alpha = 0.35, start = 0, end = 1)
par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2 pEhEx - DATA (sample 3)', lty = 9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[2,1], lty=2, col="darkblue"); # 70% INFERIOR
abline(v=CuantilesA[2,2], lty=2, col="darkblue") # 70% SUPERIOR
abline(v=CuantilesA[3,1], lty=2, col="aquamarine4"); # 75% INFERIOR
abline(v=CuantilesA[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesA[5,1], lty=2, col="brown"); # 85% INFERIOR
abline(v=CuantilesA[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesA[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesA[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesA[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesA[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesA[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesA[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2   pEhEx - ADJUSTED (sample 3)', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[2,1], lty=2, col="darkblue");  # 70% INFERIOR
abline(v=CuantilesD[2,2], lty=2, col="darkblue"); # 70% SUPERIOR
abline(v=CuantilesD[3,1], lty=2, col="aquamarine4");  # 75% INFERIOR
abline(v=CuantilesD[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesD[5,1], lty=2, col="brown");  # 85% INFERIOR
abline(v=CuantilesD[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesD[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesD[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesD[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesD[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesD[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesD[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))

Grafica Cuantiles del \(65\%\) y \(80\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2  pEhEx - DATA (sample 2)', lty=9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2  BaseMean - ADJUSTED (sample 3)', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))

Grafica Cuantiles del \(70\%\) y \(85\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence, 
     main = 'Normalized Log2 pEhEx - DATA (sample 3)', lty=9)

abline(v=CuantilesA[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesA[2,2], lty=2, col="darkblue")
abline(v=CuantilesA[5,1], lty=2, col="brown"); 
abline(v=CuantilesA[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2  pEhEx - ADJUSTED (sample 3)', lty=9)

abline(v=CuantilesD[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesD[2,2], lty=2, col="darkblue")
abline(v=CuantilesD[5,1], lty=2, col="brown"); 
abline(v=CuantilesD[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))

Muestra pEhExvsCDC51

log2vsCDC51 <- data4$log2samplevsCDC51; head(mean(log2vsCDC51)); head(sd(log2vsCDC51))
## [1] 6.073889
## [1] 2.856279
head(log2vsCDC51,5)
## [1] 5.921721 6.897596 9.430800 8.739559 6.715376
ndata4    <- length(log2vsCDC51)
hist(log2vsCDC51, breaks = nbreaks, col= rainbow(25,0.3), 
     main = 'Log2vsCDC51')

meanlog2vsCDC51 <- mean(log2vsCDC51); head(meanlog2vsCDC51)
## [1] 6.073889
StdDevlog2vsCDC51 <- sd(log2vsCDC51); head(StdDevlog2vsCDC51)
## [1] 2.856279
Normlog2vsCDC51 <- (log2vsCDC51-meanlog2vsCDC51)/StdDevlog2vsCDC51; head(Normlog2vsCDC51)
## [1] -0.05327506  0.28838461  1.17527408  0.93326643  0.22458816 -0.24564228
tst<- Normlog2vsCDC51

Primer histograma

hist(tst, breaks = nbreaks, col= 1:5, 
     main = 'Normalized Log2vsCDC51',
     xlab='pEhEx1',
     ylab= 'Frequency pEhEx')

Ajustando modelo

fw1<-fitdist(tst, "norm")
plotdist(tst, histo = TRUE, demp = TRUE)

nnorm.f <- fitdist(tst,"norm")
summary(nnorm.f)
## Fitting of the distribution ' norm ' by maximum likelihood 
## Parameters : 
##           estimate Std. Error
## mean -1.363897e-18 0.01451411
## sd    9.998946e-01 0.01026298
## Loglikelihood:  -6733.782   AIC:  13471.56   BIC:  13484.49 
## Correlation matrix:
##      mean sd
## mean    1  0
## sd      0  1
par(mfrow=c(2,2))
denscomp(nnorm.f,legendtext = 'Dist Normal')
qqcomp(nnorm.f,legendtext = 'Dist Normal')
cdfcomp(nnorm.f,legendtext = 'Dist Normal')
ppcomp(nnorm.f,legendtext = 'Dist Normal')

probs <- c();
probs[8] = 0.175;  probs[9] = 0.825; 
probs[7] = 0.15;   probs[10] = 0.85;   
probs[6] = 0.125;  probs[11] = 0.875; 
probs[5] = 0.1;    probs[12] = 0.9;    
probs[4] = 0.075;  probs[13] = 0.925; 
probs[3] = 0.05;   probs[14] = 0.95;   
probs[2] = 0.025;  probs[15] = 0.975; 
probs[1] = 0.005;  probs[16] = 0.995;  
CuantilesData <- quantile(tst,prob = probs)
CuantilesModel <- qnorm(probs, mean=0, sd=1)
Cuantilillos <- t(CuantilesModel)
colnames(Cuantilillos) <- c('0.5%','2.5%','5%','7.5%',
                            '10%','12.5%','15%','17.5%',
                            '82.5%','85%','87.5%','90%',
                            '92.5%','95%','97.5%','99.5%')
Cuantilillos <- t(Cuantilillos)
colnames(Cuantilillos) <- c('Cuantiles Ajuste')
print(Cuantilillos)
##       Cuantiles Ajuste
## 0.5%        -2.5758293
## 2.5%        -1.9599640
## 5%          -1.6448536
## 7.5%        -1.4395315
## 10%         -1.2815516
## 12.5%       -1.1503494
## 15%         -1.0364334
## 17.5%       -0.9345893
## 82.5%        0.9345893
## 85%          1.0364334
## 87.5%        1.1503494
## 90%          1.2815516
## 92.5%        1.4395315
## 95%          1.6448536
## 97.5%        1.9599640
## 99.5%        2.5758293
CuantilesA <- matrix(0,8,2)
CuantilesD <- matrix(0,8,2)
colnames(CuantilesA) <- c('LimInf','LimSup')
colnames(CuantilesD) <- c('LimInf','LimSup')
rownames(CuantilesA) <- c('65','70','75','80','85','90','95','99')
rownames(CuantilesD) <- c('65','70','75','80','85','90','95','99')
CuantilesA[1,1] <-CuantilesData[8]; CuantilesA[1,2] <-CuantilesData[9]
CuantilesA[2,1] <-CuantilesData[7]; CuantilesA[2,2] <-CuantilesData[10]
CuantilesA[3,1] <-CuantilesData[6]; CuantilesA[3,2] <-CuantilesData[11]
CuantilesA[4,1] <-CuantilesData[5]; CuantilesA[4,2] <-CuantilesData[12]
CuantilesA[5,1] <-CuantilesData[4]; CuantilesA[5,2] <-CuantilesData[13]
CuantilesA[6,1] <-CuantilesData[3]; CuantilesA[6,2] <-CuantilesData[14]
CuantilesA[7,1] <-CuantilesData[2]; CuantilesA[7,2] <-CuantilesData[15]
CuantilesA[8,1] <-CuantilesData[1]; CuantilesA[8,2] <-CuantilesData[16]
CuantilesD[1,1] <-Cuantilillos[8];  CuantilesD[1,2] <-Cuantilillos[9]
CuantilesD[2,1] <-Cuantilillos[7];  CuantilesD[2,2] <-Cuantilillos[10]
CuantilesD[3,1] <-Cuantilillos[6];  CuantilesD[3,2] <-Cuantilillos[11]
CuantilesD[4,1] <-Cuantilillos[5];  CuantilesD[4,2] <-Cuantilillos[12]
CuantilesD[5,1] <-Cuantilillos[4];  CuantilesD[5,2] <-Cuantilillos[13]
CuantilesD[6,1] <-Cuantilillos[3];  CuantilesD[6,2] <-Cuantilillos[14]
CuantilesD[7,1] <-Cuantilillos[2];  CuantilesD[7,2] <-Cuantilillos[15]
CuantilesD[8,1] <-Cuantilillos[1];  CuantilesD[8,2] <-Cuantilillos[16]
print(CuantilesD)
##        LimInf    LimSup
## 65 -0.9345893 0.9345893
## 70 -1.0364334 1.0364334
## 75 -1.1503494 1.1503494
## 80 -1.2815516 1.2815516
## 85 -1.4395315 1.4395315
## 90 -1.6448536 1.6448536
## 95 -1.9599640 1.9599640
## 99 -2.5758293 2.5758293
print(CuantilesA)
##        LimInf    LimSup
## 65 -0.8665460 0.8005323
## 70 -0.9105349 0.9400738
## 75 -0.9587235 1.1113009
## 80 -1.0119991 1.3461767
## 85 -1.0715638 1.6701383
## 90 -1.0715638 2.1555034
## 95 -1.3093554 2.7085444
## 99 -2.1265041 3.2907409

Histogramas

col_sequence <- rainbow(n = 7, alpha = 0.35, start = 0, end = 1)
par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC51 pEhEx - DATA', lty = 9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[2,1], lty=2, col="darkblue"); # 70% INFERIOR
abline(v=CuantilesA[2,2], lty=2, col="darkblue") # 70% SUPERIOR
abline(v=CuantilesA[3,1], lty=2, col="aquamarine4"); # 75% INFERIOR
abline(v=CuantilesA[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesA[5,1], lty=2, col="brown"); # 85% INFERIOR
abline(v=CuantilesA[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesA[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesA[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesA[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesA[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesA[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesA[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC51   pEhEx - ADJUSTED', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[2,1], lty=2, col="darkblue");  # 70% INFERIOR
abline(v=CuantilesD[2,2], lty=2, col="darkblue"); # 70% SUPERIOR
abline(v=CuantilesD[3,1], lty=2, col="aquamarine4");  # 75% INFERIOR
abline(v=CuantilesD[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesD[5,1], lty=2, col="brown");  # 85% INFERIOR
abline(v=CuantilesD[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesD[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesD[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesD[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesD[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesD[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesD[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))

Grafica Cuantiles del \(65\%\) y \(80\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC51  pEhEx - DATA', lty=9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC51  - ADJUSTED', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))

Grafica Cuantiles del \(70\%\) y \(85\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence, 
     main = 'Normalized Log2vsCDC51 pEhEx - DATA', lty=9)

abline(v=CuantilesA[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesA[2,2], lty=2, col="darkblue")
abline(v=CuantilesA[5,1], lty=2, col="brown"); 
abline(v=CuantilesA[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC51  pEhEx - ADJUSTED', lty=9)

abline(v=CuantilesD[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesD[2,2], lty=2, col="darkblue")
abline(v=CuantilesD[5,1], lty=2, col="brown"); 
abline(v=CuantilesD[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))

Muestra pEhExvsCDC52

log2vsCDC52 <- data4$log2samplevsCDC52; head(mean(log2vsCDC52)); head(sd(log2vsCDC52))
## [1] 6.079551
## [1] 2.958446
head(log2vsCDC52,5)
## [1] 6.157415 7.700407 9.768929 8.671526 6.790609

Primer Histograma

ndata4    <- length(log2vsCDC52)
hist(log2vsCDC52, breaks = nbreaks, col= rainbow(25,0.3), 
     main = 'Log2vsCDC52')

meanlog2vsCDC52 <- mean(log2vsCDC52); head(meanlog2vsCDC52)
## [1] 6.079551
StdDevlog2vsCDC52 <- sd(log2vsCDC52); head(StdDevlog2vsCDC52)
## [1] 2.958446
Normlog2vsCDC52 <- (log2vsCDC52-meanlog2vsCDC52)/StdDevlog2vsCDC52; head(Normlog2vsCDC52)
## [1]  0.02631943  0.54787417  1.24706626  0.87612726  0.24034856 -0.30491137
tst<- Normlog2vsCDC52

** Segundo Histograma**

hist(tst, breaks = nbreaks, col= 1:5, 
     main = 'Normalized Log2vsCDC52',
     xlab='pEhEx1',
     ylab= 'Frequency pEhEx')

Ajustando modelo

fw1<-fitdist(tst, "norm")
plotdist(tst, histo = TRUE, demp = TRUE)

nnorm.f <- fitdist(tst,"norm")
summary(nnorm.f)
## Fitting of the distribution ' norm ' by maximum likelihood 
## Parameters : 
##           estimate Std. Error
## mean -9.044811e-17 0.01451411
## sd    9.998946e-01 0.01026298
## Loglikelihood:  -6733.782   AIC:  13471.56   BIC:  13484.49 
## Correlation matrix:
##               mean            sd
## mean  1.000000e+00 -3.386913e-11
## sd   -3.386913e-11  1.000000e+00
par(mfrow=c(2,2))
denscomp(nnorm.f,legendtext = 'Dist Normal')
qqcomp(nnorm.f,legendtext = 'Dist Normal')
cdfcomp(nnorm.f,legendtext = 'Dist Normal')
ppcomp(nnorm.f,legendtext = 'Dist Normal')

Cálculo de cuantiles

probs <- c();
probs[8] = 0.175;  probs[9] = 0.825; 
probs[7] = 0.15;   probs[10] = 0.85;   
probs[6] = 0.125;  probs[11] = 0.875; 
probs[5] = 0.1;    probs[12] = 0.9;    
probs[4] = 0.075;  probs[13] = 0.925; 
probs[3] = 0.05;   probs[14] = 0.95;   
probs[2] = 0.025;  probs[15] = 0.975; 
probs[1] = 0.005;  probs[16] = 0.995;  
CuantilesData <- quantile(tst,prob = probs)
CuantilesModel <- qnorm(probs, mean=0, sd=1)
Cuantilillos <- t(CuantilesModel)
colnames(Cuantilillos) <- c('0.5%','2.5%','5%','7.5%',
                            '10%','12.5%','15%','17.5%',
                            '82.5%','85%','87.5%','90%',
                            '92.5%','95%','97.5%','99.5%')
Cuantilillos <- t(Cuantilillos)
colnames(Cuantilillos) <- c('Cuantiles Ajuste')
print(Cuantilillos)
##       Cuantiles Ajuste
## 0.5%        -2.5758293
## 2.5%        -1.9599640
## 5%          -1.6448536
## 7.5%        -1.4395315
## 10%         -1.2815516
## 12.5%       -1.1503494
## 15%         -1.0364334
## 17.5%       -0.9345893
## 82.5%        0.9345893
## 85%          1.0364334
## 87.5%        1.1503494
## 90%          1.2815516
## 92.5%        1.4395315
## 95%          1.6448536
## 97.5%        1.9599640
## 99.5%        2.5758293
CuantilesA <- matrix(0,8,2)
CuantilesD <- matrix(0,8,2)
colnames(CuantilesA) <- c('LimInf','LimSup')
colnames(CuantilesD) <- c('LimInf','LimSup')
rownames(CuantilesA) <- c('65','70','75','80','85','90','95','99')
rownames(CuantilesD) <- c('65','70','75','80','85','90','95','99')
CuantilesA[1,1] <-CuantilesData[8]; CuantilesA[1,2] <-CuantilesData[9]
CuantilesA[2,1] <-CuantilesData[7]; CuantilesA[2,2] <-CuantilesData[10]
CuantilesA[3,1] <-CuantilesData[6]; CuantilesA[3,2] <-CuantilesData[11]
CuantilesA[4,1] <-CuantilesData[5]; CuantilesA[4,2] <-CuantilesData[12]
CuantilesA[5,1] <-CuantilesData[4]; CuantilesA[5,2] <-CuantilesData[13]
CuantilesA[6,1] <-CuantilesData[3]; CuantilesA[6,2] <-CuantilesData[14]
CuantilesA[7,1] <-CuantilesData[2]; CuantilesA[7,2] <-CuantilesData[15]
CuantilesA[8,1] <-CuantilesData[1]; CuantilesA[8,2] <-CuantilesData[16]
CuantilesD[1,1] <-Cuantilillos[8];  CuantilesD[1,2] <-Cuantilillos[9]
CuantilesD[2,1] <-Cuantilillos[7];  CuantilesD[2,2] <-Cuantilillos[10]
CuantilesD[3,1] <-Cuantilillos[6];  CuantilesD[3,2] <-Cuantilillos[11]
CuantilesD[4,1] <-Cuantilillos[5];  CuantilesD[4,2] <-Cuantilillos[12]
CuantilesD[5,1] <-Cuantilillos[4];  CuantilesD[5,2] <-Cuantilillos[13]
CuantilesD[6,1] <-Cuantilillos[3];  CuantilesD[6,2] <-Cuantilillos[14]
CuantilesD[7,1] <-Cuantilillos[2];  CuantilesD[7,2] <-Cuantilillos[15]
CuantilesD[8,1] <-Cuantilillos[1];  CuantilesD[8,2] <-Cuantilillos[16]
print(CuantilesD)
##        LimInf    LimSup
## 65 -0.9345893 0.9345893
## 70 -1.0364334 1.0364334
## 75 -1.1503494 1.1503494
## 80 -1.2815516 1.2815516
## 85 -1.4395315 1.4395315
## 90 -1.6448536 1.6448536
## 95 -1.9599640 1.9599640
## 99 -2.5758293 2.5758293
print(CuantilesA)
##        LimInf    LimSup
## 65 -0.8703761 0.8136491
## 70 -0.9170047 0.9590243
## 75 -0.9685679 1.1169792
## 80 -1.0262349 1.3717093
## 85 -1.0916475 1.6775570
## 90 -1.1672140 2.1543218
## 95 -1.3663234 2.6103392
## 99 -2.0549813 3.1594798

Histogramas

col_sequence <- rainbow(n = 7, alpha = 0.35, start = 0, end = 1)
par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC52 pEhEx - DATA', lty = 9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[2,1], lty=2, col="darkblue"); # 70% INFERIOR
abline(v=CuantilesA[2,2], lty=2, col="darkblue") # 70% SUPERIOR
abline(v=CuantilesA[3,1], lty=2, col="aquamarine4"); # 75% INFERIOR
abline(v=CuantilesA[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesA[5,1], lty=2, col="brown"); # 85% INFERIOR
abline(v=CuantilesA[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesA[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesA[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesA[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesA[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesA[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesA[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC52   pEhEx - ADJUSTED', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[2,1], lty=2, col="darkblue");  # 70% INFERIOR
abline(v=CuantilesD[2,2], lty=2, col="darkblue"); # 70% SUPERIOR
abline(v=CuantilesD[3,1], lty=2, col="aquamarine4");  # 75% INFERIOR
abline(v=CuantilesD[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesD[5,1], lty=2, col="brown");  # 85% INFERIOR
abline(v=CuantilesD[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesD[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesD[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesD[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesD[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesD[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesD[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))

Grafica Cuantiles del \(65\%\) y \(80\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC52  pEhEx - DATA', lty=9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC52  - ADJUSTED', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))

Grafica Cuantiles del \(70\%\) y \(85\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence, 
     main = 'Normalized Log2vsCDC52 pEhEx - DATA', lty=9)

abline(v=CuantilesA[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesA[2,2], lty=2, col="darkblue")
abline(v=CuantilesA[5,1], lty=2, col="brown"); 
abline(v=CuantilesA[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC52  pEhEx - ADJUSTED', lty=9)

abline(v=CuantilesD[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesD[2,2], lty=2, col="darkblue")
abline(v=CuantilesD[5,1], lty=2, col="brown"); 
abline(v=CuantilesD[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))

Muestra pEhExvsCDC53

log2vsCDC53 <- data4$log2samplevsCDC53; head(mean(log2vsCDC53)); head(sd(log2vsCDC53))
## [1] 6.151641
## [1] 3.315575
head(log2vsCDC53,5)
## [1]  9.256488  6.538327 13.437122 10.651844  8.724550
ndata4    <- length(log2vsCDC53)

** Primer histograma**

hist(log2vsCDC53, breaks = nbreaks, col= rainbow(25,0.3), 
     main = 'Log2vsCDC53')

meanlog2vsCDC53 <- mean(log2vsCDC53); head(meanlog2vsCDC53)
## [1] 6.151641
StdDevlog2vsCDC53 <- sd(log2vsCDC53); head(StdDevlog2vsCDC53)
## [1] 3.315575
Normlog2vsCDC53 <- (log2vsCDC53-meanlog2vsCDC53)/StdDevlog2vsCDC53; head(Normlog2vsCDC53)
## [1] 0.9364429 0.1166271 2.1973504 1.3572917 0.7760066 0.1877447
tst<- Normlog2vsCDC53

Segundo histograma

hist(tst, breaks = nbreaks, col= 1:5, 
     main = 'Normalized Log2vsCDC53',
     xlab='pEhEx1',
     ylab= 'Frequency pEhEx')

Ajustando modelo

fw1<-fitdist(tst, "norm")
plotdist(tst, histo = TRUE, demp = TRUE)

nnorm.f <- fitdist(tst,"norm")
summary(nnorm.f)
## Fitting of the distribution ' norm ' by maximum likelihood 
## Parameters : 
##           estimate Std. Error
## mean -1.080389e-16 0.01451411
## sd    9.998946e-01 0.01026298
## Loglikelihood:  -6733.782   AIC:  13471.56   BIC:  13484.49 
## Correlation matrix:
##      mean sd
## mean    1  0
## sd      0  1
par(mfrow=c(2,2))
denscomp(nnorm.f,legendtext = 'Dist Normal')
qqcomp(nnorm.f,legendtext = 'Dist Normal')
cdfcomp(nnorm.f,legendtext = 'Dist Normal')
ppcomp(nnorm.f,legendtext = 'Dist Normal')

Calculo de cuantiles

probs <- c();
probs[8] = 0.175;  probs[9] = 0.825; 
probs[7] = 0.15;   probs[10] = 0.85;   
probs[6] = 0.125;  probs[11] = 0.875; 
probs[5] = 0.1;    probs[12] = 0.9;    
probs[4] = 0.075;  probs[13] = 0.925; 
probs[3] = 0.05;   probs[14] = 0.95;   
probs[2] = 0.025;  probs[15] = 0.975; 
probs[1] = 0.005;  probs[16] = 0.995;  
CuantilesData <- quantile(tst,prob = probs)
CuantilesModel <- qnorm(probs, mean=0, sd=1)
Cuantilillos <- t(CuantilesModel)
colnames(Cuantilillos) <- c('0.5%','2.5%','5%','7.5%',
                            '10%','12.5%','15%','17.5%',
                            '82.5%','85%','87.5%','90%',
                            '92.5%','95%','97.5%','99.5%')
Cuantilillos <- t(Cuantilillos)
colnames(Cuantilillos) <- c('Cuantiles Ajuste')
print(Cuantilillos)
##       Cuantiles Ajuste
## 0.5%        -2.5758293
## 2.5%        -1.9599640
## 5%          -1.6448536
## 7.5%        -1.4395315
## 10%         -1.2815516
## 12.5%       -1.1503494
## 15%         -1.0364334
## 17.5%       -0.9345893
## 82.5%        0.9345893
## 85%          1.0364334
## 87.5%        1.1503494
## 90%          1.2815516
## 92.5%        1.4395315
## 95%          1.6448536
## 97.5%        1.9599640
## 99.5%        2.5758293
CuantilesA <- matrix(0,8,2)
CuantilesD <- matrix(0,8,2)
colnames(CuantilesA) <- c('LimInf','LimSup')
colnames(CuantilesD) <- c('LimInf','LimSup')
rownames(CuantilesA) <- c('65','70','75','80','85','90','95','99')
rownames(CuantilesD) <- c('65','70','75','80','85','90','95','99')
CuantilesA[1,1] <-CuantilesData[8]; CuantilesA[1,2] <-CuantilesData[9]
CuantilesA[2,1] <-CuantilesData[7]; CuantilesA[2,2] <-CuantilesData[10]
CuantilesA[3,1] <-CuantilesData[6]; CuantilesA[3,2] <-CuantilesData[11]
CuantilesA[4,1] <-CuantilesData[5]; CuantilesA[4,2] <-CuantilesData[12]
CuantilesA[5,1] <-CuantilesData[4]; CuantilesA[5,2] <-CuantilesData[13]
CuantilesA[6,1] <-CuantilesData[3]; CuantilesA[6,2] <-CuantilesData[14]
CuantilesA[7,1] <-CuantilesData[2]; CuantilesA[7,2] <-CuantilesData[15]
CuantilesA[8,1] <-CuantilesData[1]; CuantilesA[8,2] <-CuantilesData[16]
CuantilesD[1,1] <-Cuantilillos[8];  CuantilesD[1,2] <-Cuantilillos[9]
CuantilesD[2,1] <-Cuantilillos[7];  CuantilesD[2,2] <-Cuantilillos[10]
CuantilesD[3,1] <-Cuantilillos[6];  CuantilesD[3,2] <-Cuantilillos[11]
CuantilesD[4,1] <-Cuantilillos[5];  CuantilesD[4,2] <-Cuantilillos[12]
CuantilesD[5,1] <-Cuantilillos[4];  CuantilesD[5,2] <-Cuantilillos[13]
CuantilesD[6,1] <-Cuantilillos[3];  CuantilesD[6,2] <-Cuantilillos[14]
CuantilesD[7,1] <-Cuantilillos[2];  CuantilesD[7,2] <-Cuantilillos[15]
CuantilesD[8,1] <-Cuantilillos[1];  CuantilesD[8,2] <-Cuantilillos[16]
print(CuantilesD)
##        LimInf    LimSup
## 65 -0.9345893 0.9345893
## 70 -1.0364334 1.0364334
## 75 -1.1503494 1.1503494
## 80 -1.2815516 1.2815516
## 85 -1.4395315 1.4395315
## 90 -1.6448536 1.6448536
## 95 -1.9599640 1.9599640
## 99 -2.5758293 2.5758293
print(CuantilesA)
##        LimInf    LimSup
## 65 -0.8351247 0.8675257
## 70 -0.9466147 0.9977469
## 75 -0.9466147 1.1516663
## 80 -1.0968948 1.3476203
## 85 -1.3283399 1.5933747
## 90 -1.3283399 1.8884142
## 95 -1.8553769 2.3619041
## 99 -1.8553769 3.1601836

Histogramas

col_sequence <- rainbow(n = 7, alpha = 0.35, start = 0, end = 1)
par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC53 pEhEx - DATA', lty = 9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[2,1], lty=2, col="darkblue"); # 70% INFERIOR
abline(v=CuantilesA[2,2], lty=2, col="darkblue") # 70% SUPERIOR
abline(v=CuantilesA[3,1], lty=2, col="aquamarine4"); # 75% INFERIOR
abline(v=CuantilesA[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesA[5,1], lty=2, col="brown"); # 85% INFERIOR
abline(v=CuantilesA[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesA[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesA[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesA[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesA[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesA[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesA[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC53   pEhEx - ADJUSTED', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[2,1], lty=2, col="darkblue");  # 70% INFERIOR
abline(v=CuantilesD[2,2], lty=2, col="darkblue"); # 70% SUPERIOR
abline(v=CuantilesD[3,1], lty=2, col="aquamarine4");  # 75% INFERIOR
abline(v=CuantilesD[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesD[5,1], lty=2, col="brown");  # 85% INFERIOR
abline(v=CuantilesD[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesD[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesD[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesD[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesD[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesD[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesD[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))

Grafica Cuantiles del \(65\%\) y \(80\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC53  pEhEx - DATA', lty=9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC51  - ADJUSTED', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))

Grafica Cuantiles del \(70\%\) y \(85\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence, 
     main = 'Normalized Log2vsCDC53 pEhEx - DATA', lty=9)

abline(v=CuantilesA[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesA[2,2], lty=2, col="darkblue")
abline(v=CuantilesA[5,1], lty=2, col="brown"); 
abline(v=CuantilesA[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsCDC53  pEhEx - ADJUSTED', lty=9)

abline(v=CuantilesD[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesD[2,2], lty=2, col="darkblue")
abline(v=CuantilesD[5,1], lty=2, col="brown"); 
abline(v=CuantilesD[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))

Quinta Clasificacion: pEhExvsUmasM

head(pEhExvsUmasM,10);
## # A tibble: 10 × 7
##    GenId       UmasM_1 UmasM_2 UmasM_3 pEhEx_1 pEhEx_2 pEhEx_3
##    <chr>         <dbl>   <dbl>   <dbl>   <dbl>   <dbl>   <dbl>
##  1 EHI_000130A    52.8   428.    877.    175.    432.    478. 
##  2 EHI_000140A   118.    371.     43.7   353.    341.     38.8
##  3 EHI_000240A   744.   1165.   7104.   1175.   1932.   2122. 
##  4 EHI_000250A   704.    213.   1578.    325.    327.    659. 
##  5 EHI_000260A   119.     96.2   139.    109.     67.0    50.3
##  6 EHI_000280A    57.6    59.6    34.3    54.9    83.4    61.8
##  7 EHI_000290A    26.4    19.7    70.2    18.5    14.1    81.2
##  8 EHI_000300A    80.4   115.     15.6   134.    115.     31.6
##  9 EHI_000410A    20.4    24.4   139.     28.2    24.7    65.4
## 10 EHI_000430A    31.2    35.9    14.0    26.0    14.1    10.8
nbreaks <- 10
data5 <- pEhExvsUmasM;       head(data5)
## # A tibble: 6 × 7
##   GenId       UmasM_1 UmasM_2 UmasM_3 pEhEx_1 pEhEx_2 pEhEx_3
##   <chr>         <dbl>   <dbl>   <dbl>   <dbl>   <dbl>   <dbl>
## 1 EHI_000130A    52.8   428.    877.    175.    432.    478. 
## 2 EHI_000140A   118.    371.     43.7   353.    341.     38.8
## 3 EHI_000240A   744.   1165.   7104.   1175.   1932.   2122. 
## 4 EHI_000250A   704.    213.   1578.    325.    327.    659. 
## 5 EHI_000260A   119.     96.2   139.    109.     67.0    50.3
## 6 EHI_000280A    57.6    59.6    34.3    54.9    83.4    61.8

Log-Normalización

sample1   <- data5$pEhEx_1; sample2   <- data5$pEhEx_2; sample3   <- data5$pEhEx_3;
samplevs1 <- data5$UmasM_1;  samplevs2 <- data5$UmasM_2;  samplevs3 <- data5$UmasM_3;
log2sample1 <- log2(sample1+1);         log2sample2 <- log2(sample2+1)
log2sample3 <- log2(sample3+1);         log2samplevsumasM1 <- log2(samplevs1+1)
log2samplevsumasM2 <- log2(samplevs2+1); log2samplevsumasM3 <- log2(samplevs3+1)
data5 <- cbind(data5, log2sample1,log2sample2,log2sample3,
               log2samplevsumasM1,log2samplevsumasM2,log2samplevsumasM3)
head(data5)
##         GenId   UmasM_1    UmasM_2    UmasM_3    pEhEx_1    pEhEx_2    pEhEx_3
## 1 EHI_000130A  52.79569  428.31302  877.32975  175.05490  432.49403  478.29632
## 2 EHI_000140A 117.59041  370.70763   43.71038  353.07682  340.82410   38.78078
## 3 EHI_000240A 743.93931 1164.98430 7104.49766 1174.94473 1932.12006 2122.17063
## 4 EHI_000250A 704.34254  212.80109 1578.25690  324.89002  326.72103  658.55515
## 5 EHI_000260A 118.79031   96.23489  138.93656  109.03843   66.98956   50.27139
## 6 EHI_000280A  57.59530   59.63852   34.34387   54.89009   83.44314   61.76199
##   log2sample1 log2sample2 log2sample3 log2samplevsumasM1 log2samplevsumasM2
## 1    7.459882    8.759868    8.904774           5.749419           8.745886
## 2    8.467919    8.417110    5.314000           6.889844           8.538024
## 3   10.199605   10.916716   11.052005           9.540979          10.187333
## 4    8.348241    8.356324    9.365349           9.462180           7.740125
## 5    6.781864    6.087241    5.680082           6.904367           6.603402
## 6    5.804521    6.399908    5.971819           5.872713           5.922163
##   log2samplevsumasM3
## 1           9.778619
## 2           5.482538
## 3          12.794720
## 4          10.625030
## 5           7.128629
## 6           5.143388
save.image('CheckPointSixth.RData')
setwd("~/Documents/GitHub/Resultados/docs/PrimeroDiffExpAllResults/Clasificando/Abundances")
#load('CheckPointTwo.RData')
library(ggplot2);library(dplyr);library("fitdistrplus");
library("MASS");library("survival")
head(data5)
##         GenId   UmasM_1    UmasM_2    UmasM_3    pEhEx_1    pEhEx_2    pEhEx_3
## 1 EHI_000130A  52.79569  428.31302  877.32975  175.05490  432.49403  478.29632
## 2 EHI_000140A 117.59041  370.70763   43.71038  353.07682  340.82410   38.78078
## 3 EHI_000240A 743.93931 1164.98430 7104.49766 1174.94473 1932.12006 2122.17063
## 4 EHI_000250A 704.34254  212.80109 1578.25690  324.89002  326.72103  658.55515
## 5 EHI_000260A 118.79031   96.23489  138.93656  109.03843   66.98956   50.27139
## 6 EHI_000280A  57.59530   59.63852   34.34387   54.89009   83.44314   61.76199
##   log2sample1 log2sample2 log2sample3 log2samplevsumasM1 log2samplevsumasM2
## 1    7.459882    8.759868    8.904774           5.749419           8.745886
## 2    8.467919    8.417110    5.314000           6.889844           8.538024
## 3   10.199605   10.916716   11.052005           9.540979          10.187333
## 4    8.348241    8.356324    9.365349           9.462180           7.740125
## 5    6.781864    6.087241    5.680082           6.904367           6.603402
## 6    5.804521    6.399908    5.971819           5.872713           5.922163
##   log2samplevsumasM3
## 1           9.778619
## 2           5.482538
## 3          12.794720
## 4          10.625030
## 5           7.128629
## 6           5.143388

Muestra 1

log2sample1 <- data5$log2sample1; head(mean(log2sample1)); head(sd(log2sample1))
## [1] 6.24652
## [1] 2.884429
head(log2sample1,5)
## [1]  7.459882  8.467919 10.199605  8.348241  6.781864
summary(data5)
##     GenId              UmasM_1            UmasM_2             UmasM_3         
##  Length:4919        Min.   :     0.0   Min.   :     0.00   Min.   :      0.0  
##  Class :character   1st Qu.:    16.8   1st Qu.:    18.30   1st Qu.:     14.0  
##  Mode  :character   Median :    46.8   Median :    52.18   Median :     54.6  
##                     Mean   :  1915.1   Mean   :  1003.67   Mean   :   3444.8  
##                     3rd Qu.:   198.0   3rd Qu.:   193.15   3rd Qu.:    295.0  
##                     Max.   :340994.2   Max.   :145896.83   Max.   :1488475.8  
##     pEhEx_1             pEhEx_2             pEhEx_3          log2sample1    
##  Min.   :     0.00   Min.   :     0.00   Min.   :     0.0   Min.   : 0.000  
##  1st Qu.:    16.32   1st Qu.:    15.28   1st Qu.:    15.1   1st Qu.: 4.114  
##  Median :    48.96   Median :    48.19   Median :    52.4   Median : 5.643  
##  Mean   :  1394.44   Mean   :  1752.18   Mean   :  1898.2   Mean   : 6.247  
##  3rd Qu.:   199.53   3rd Qu.:   222.71   3rd Qu.:   231.2   3rd Qu.: 7.648  
##  Max.   :213518.02   Max.   :279409.95   Max.   :724577.3   Max.   :17.704  
##   log2sample2      log2sample3     log2samplevsumasM1 log2samplevsumasM2
##  Min.   : 0.000   Min.   : 0.000   Min.   : 0.000     Min.   : 0.000    
##  1st Qu.: 4.025   1st Qu.: 4.007   1st Qu.: 4.154     1st Qu.: 4.270    
##  Median : 5.620   Median : 5.739   Median : 5.579     Median : 5.733    
##  Mean   : 6.187   Mean   : 6.152   Mean   : 6.222     Mean   : 6.256    
##  3rd Qu.: 7.805   3rd Qu.: 7.860   3rd Qu.: 7.637     3rd Qu.: 7.601    
##  Max.   :18.092   Max.   :19.467   Max.   :18.379     Max.   :17.155    
##  log2samplevsumasM3
##  Min.   : 0.000    
##  1st Qu.: 3.912    
##  Median : 5.798    
##  Mean   : 6.317    
##  3rd Qu.: 8.210    
##  Max.   :20.505
ndata5    <- length(log2sample1)
hist(log2sample1, breaks = nbreaks, col= rainbow(25,0.3), 
     main = 'Log2 sample1')

meanlog2sample1 <- mean(log2sample1); head(meanlog2sample1)
## [1] 6.24652
StdDevlog2sample1 <- sd(log2sample1); head(StdDevlog2sample1)
## [1] 2.884429
Normlog2sample1 <- (log2sample1-meanlog2sample1)/StdDevlog2sample1; head(Normlog2sample1)
## [1]  0.4206592  0.7701346  1.3704911  0.7286438  0.1855978 -0.1532363
tst<- Normlog2sample1

hist(tst, breaks = nbreaks, col= 1:5, 
     main = 'Normalized Log2sample1',
     xlab='pEhEx1',
     ylab= 'Frequency pEhEx')

fw1<-fitdist(tst, "norm")
plotdist(tst, histo = TRUE, demp = TRUE)

nnorm.f <- fitdist(tst,"norm")
summary(nnorm.f)
## Fitting of the distribution ' norm ' by maximum likelihood 
## Parameters : 
##           estimate Std. Error
## mean -1.310539e-16 0.01425665
## sd    9.998983e-01 0.01008093
## Loglikelihood:  -6979.259   AIC:  13962.52   BIC:  13975.52 
## Correlation matrix:
##      mean sd
## mean    1  0
## sd      0  1
par(mfrow=c(2,2))
denscomp(nnorm.f,legendtext = 'Dist Normal')
qqcomp(nnorm.f,legendtext = 'Dist Normal')
cdfcomp(nnorm.f,legendtext = 'Dist Normal')
ppcomp(nnorm.f,legendtext = 'Dist Normal')

probs <- c();
probs[8] = 0.175;  probs[9] = 0.825; 
probs[7] = 0.15;   probs[10] = 0.85;   
probs[6] = 0.125;  probs[11] = 0.875; 
probs[5] = 0.1;    probs[12] = 0.9;    
probs[4] = 0.075;  probs[13] = 0.925; 
probs[3] = 0.05;   probs[14] = 0.95;   
probs[2] = 0.025;  probs[15] = 0.975; 
probs[1] = 0.005;  probs[16] = 0.995;  
CuantilesData <- quantile(tst,prob = probs)
CuantilesModel <- qnorm(probs, mean=0, sd=1)
Cuantilillos <- t(CuantilesModel)
colnames(Cuantilillos) <- c('0.5%','2.5%','5%','7.5%',
                            '10%','12.5%','15%','17.5%',
                            '82.5%','85%','87.5%','90%',
                            '92.5%','95%','97.5%','99.5%')
Cuantilillos <- t(Cuantilillos)
colnames(Cuantilillos) <- c('Cuantiles Ajuste')
print(Cuantilillos)
##       Cuantiles Ajuste
## 0.5%        -2.5758293
## 2.5%        -1.9599640
## 5%          -1.6448536
## 7.5%        -1.4395315
## 10%         -1.2815516
## 12.5%       -1.1503494
## 15%         -1.0364334
## 17.5%       -0.9345893
## 82.5%        0.9345893
## 85%          1.0364334
## 87.5%        1.1503494
## 90%          1.2815516
## 92.5%        1.4395315
## 95%          1.6448536
## 97.5%        1.9599640
## 99.5%        2.5758293

Cálculo de cuantiles

CuantilesA <- matrix(0,8,2)
CuantilesD <- matrix(0,8,2)
colnames(CuantilesA) <- c('LimInf','LimSup')
colnames(CuantilesD) <- c('LimInf','LimSup')
rownames(CuantilesA) <- c('65','70','75','80','85','90','95','99')
rownames(CuantilesD) <- c('65','70','75','80','85','90','95','99')
CuantilesA[1,1] <-CuantilesData[8]; CuantilesA[1,2] <-CuantilesData[9]
CuantilesA[2,1] <-CuantilesData[7]; CuantilesA[2,2] <-CuantilesData[10]
CuantilesA[3,1] <-CuantilesData[6]; CuantilesA[3,2] <-CuantilesData[11]
CuantilesA[4,1] <-CuantilesData[5]; CuantilesA[4,2] <-CuantilesData[12]
CuantilesA[5,1] <-CuantilesData[4]; CuantilesA[5,2] <-CuantilesData[13]
CuantilesA[6,1] <-CuantilesData[3]; CuantilesA[6,2] <-CuantilesData[14]
CuantilesA[7,1] <-CuantilesData[2]; CuantilesA[7,2] <-CuantilesData[15]
CuantilesA[8,1] <-CuantilesData[1]; CuantilesA[8,2] <-CuantilesData[16]
CuantilesD[1,1] <-Cuantilillos[8];  CuantilesD[1,2] <-Cuantilillos[9]
CuantilesD[2,1] <-Cuantilillos[7];  CuantilesD[2,2] <-Cuantilillos[10]
CuantilesD[3,1] <-Cuantilillos[6];  CuantilesD[3,2] <-Cuantilillos[11]
CuantilesD[4,1] <-Cuantilillos[5];  CuantilesD[4,2] <-Cuantilillos[12]
CuantilesD[5,1] <-Cuantilillos[4];  CuantilesD[5,2] <-Cuantilillos[13]
CuantilesD[6,1] <-Cuantilillos[3];  CuantilesD[6,2] <-Cuantilillos[14]
CuantilesD[7,1] <-Cuantilillos[2];  CuantilesD[7,2] <-Cuantilillos[15]
CuantilesD[8,1] <-Cuantilillos[1];  CuantilesD[8,2] <-Cuantilillos[16]
print(CuantilesD)
##        LimInf    LimSup
## 65 -0.9345893 0.9345893
## 70 -1.0364334 1.0364334
## 75 -1.1503494 1.1503494
## 80 -1.2815516 1.2815516
## 85 -1.4395315 1.4395315
## 90 -1.6448536 1.6448536
## 95 -1.9599640 1.9599640
## 99 -2.5758293 2.5758293
print(CuantilesA)
##        LimInf    LimSup
## 65 -0.8877976 0.8234548
## 70 -0.9174931 0.9668385
## 75 -0.9827617 1.1346553
## 80 -1.0188953 1.3615138
## 85 -1.1000839 1.6923518
## 90 -1.1462228 2.1593960
## 95 -1.3906263 2.6069712
## 99 -2.1655999 3.1547856
col_sequence <- rainbow(n = 7, alpha = 0.35, start = 0, end = 1)
par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2 pEhEx - DATA', lty = 9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[2,1], lty=2, col="darkblue"); # 70% INFERIOR
abline(v=CuantilesA[2,2], lty=2, col="darkblue") # 70% SUPERIOR
abline(v=CuantilesA[3,1], lty=2, col="aquamarine4"); # 75% INFERIOR
abline(v=CuantilesA[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesA[5,1], lty=2, col="brown"); # 85% INFERIOR
abline(v=CuantilesA[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesA[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesA[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesA[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesA[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesA[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesA[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2   pEhEx - ADJUSTED', lty=9)
abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[2,1], lty=2, col="darkblue");  # 70% INFERIOR
abline(v=CuantilesD[2,2], lty=2, col="darkblue"); # 70% SUPERIOR
abline(v=CuantilesD[3,1], lty=2, col="aquamarine4");  # 75% INFERIOR
abline(v=CuantilesD[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesD[5,1], lty=2, col="brown");  # 85% INFERIOR
abline(v=CuantilesD[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesD[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesD[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesD[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesD[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesD[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesD[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))

Grafica Cuantiles del \(65\%\) y \(80\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2  pEhEx - DATA', lty=9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2  BaseMean - ADJUSTED', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))

Grafica Cuantiles del \(70\%\) y \(85\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence, 
     main = 'Normalized Log2 pEhEx - DATA', lty=9)

abline(v=CuantilesA[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesA[2,2], lty=2, col="darkblue")
abline(v=CuantilesA[5,1], lty=2, col="brown"); 
abline(v=CuantilesA[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2  pEhEx - ADJUSTED', lty=9)

abline(v=CuantilesD[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesD[2,2], lty=2, col="darkblue")
abline(v=CuantilesD[5,1], lty=2, col="brown"); 
abline(v=CuantilesD[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))

Muestra 2

log2sample2 <- data5$log2sample2; head(mean(log2sample2)); head(sd(log2sample2))
## [1] 6.18657
## [1] 3.14197
head(log2sample2,5)
## [1]  8.759868  8.417110 10.916716  8.356324  6.087241
ndata5    <- length(log2sample2)
hist(log2sample2, breaks = nbreaks, col= rainbow(25,0.3), 
     main = 'Log2 sample2')

Log-normalizacion

meanlog2sample2 <- mean(log2sample2); head(meanlog2sample2)
## [1] 6.18657
StdDevlog2sample2 <- sd(log2sample2); head(StdDevlog2sample2)
## [1] 3.14197
Normlog2sample2 <- (log2sample2-meanlog2sample2)/StdDevlog2sample2; head(Normlog2sample2)
## [1]  0.81900802  0.70991786  1.50547137  0.69057145 -0.03161338  0.06789964
tst<- Normlog2sample2
hist(tst, breaks = nbreaks, col= 1:5, 
     main = 'Normalized Log2sample1',
     xlab='pEhEx1',
     ylab= 'Frequency pEhEx')

Ajuste de modelo

fw1<-fitdist(tst, "norm")
plotdist(tst, histo = TRUE, demp = TRUE)

nnorm.f <- fitdist(tst,"norm")
summary(nnorm.f)
## Fitting of the distribution ' norm ' by maximum likelihood 
## Parameters : 
##           estimate Std. Error
## mean -1.093861e-16 0.01425665
## sd    9.998983e-01 0.01008093
## Loglikelihood:  -6979.259   AIC:  13962.52   BIC:  13975.52 
## Correlation matrix:
##      mean sd
## mean    1  0
## sd      0  1
par(mfrow=c(2,2))
denscomp(nnorm.f,legendtext = 'Dist Normal')
qqcomp(nnorm.f,legendtext = 'Dist Normal')
cdfcomp(nnorm.f,legendtext = 'Dist Normal')
ppcomp(nnorm.f,legendtext = 'Dist Normal')

probs <- c();
probs[8] = 0.175;  probs[9] = 0.825; 
probs[7] = 0.15;   probs[10] = 0.85;   
probs[6] = 0.125;  probs[11] = 0.875; 
probs[5] = 0.1;    probs[12] = 0.9;    
probs[4] = 0.075;  probs[13] = 0.925; 
probs[3] = 0.05;   probs[14] = 0.95;   
probs[2] = 0.025;  probs[15] = 0.975; 
probs[1] = 0.005;  probs[16] = 0.995;  
CuantilesData <- quantile(tst,prob = probs)
CuantilesModel <- qnorm(probs, mean=0, sd=1)
Cuantilillos <- t(CuantilesModel)
colnames(Cuantilillos) <- c('0.5%','2.5%','5%','7.5%',
                            '10%','12.5%','15%','17.5%',
                            '82.5%','85%','87.5%','90%',
                            '92.5%','95%','97.5%','99.5%')
Cuantilillos <- t(Cuantilillos)
colnames(Cuantilillos) <- c('Cuantiles Ajuste')
print(Cuantilillos)
##       Cuantiles Ajuste
## 0.5%        -2.5758293
## 2.5%        -1.9599640
## 5%          -1.6448536
## 7.5%        -1.4395315
## 10%         -1.2815516
## 12.5%       -1.1503494
## 15%         -1.0364334
## 17.5%       -0.9345893
## 82.5%        0.9345893
## 85%          1.0364334
## 87.5%        1.1503494
## 90%          1.2815516
## 92.5%        1.4395315
## 95%          1.6448536
## 97.5%        1.9599640
## 99.5%        2.5758293
CuantilesA <- matrix(0,8,2)
CuantilesD <- matrix(0,8,2)
colnames(CuantilesA) <- c('LimInf','LimSup')
colnames(CuantilesD) <- c('LimInf','LimSup')
rownames(CuantilesA) <- c('65','70','75','80','85','90','95','99')
rownames(CuantilesD) <- c('65','70','75','80','85','90','95','99')
CuantilesA[1,1] <-CuantilesData[8]; CuantilesA[1,2] <-CuantilesData[9]
CuantilesA[2,1] <-CuantilesData[7]; CuantilesA[2,2] <-CuantilesData[10]
CuantilesA[3,1] <-CuantilesData[6]; CuantilesA[3,2] <-CuantilesData[11]
CuantilesA[4,1] <-CuantilesData[5]; CuantilesA[4,2] <-CuantilesData[12]
CuantilesA[5,1] <-CuantilesData[4]; CuantilesA[5,2] <-CuantilesData[13]
CuantilesA[6,1] <-CuantilesData[3]; CuantilesA[6,2] <-CuantilesData[14]
CuantilesA[7,1] <-CuantilesData[2]; CuantilesA[7,2] <-CuantilesData[15]
CuantilesA[8,1] <-CuantilesData[1]; CuantilesA[8,2] <-CuantilesData[16]
CuantilesD[1,1] <-Cuantilillos[8];  CuantilesD[1,2] <-Cuantilillos[9]
CuantilesD[2,1] <-Cuantilillos[7];  CuantilesD[2,2] <-Cuantilillos[10]
CuantilesD[3,1] <-Cuantilillos[6];  CuantilesD[3,2] <-Cuantilillos[11]
CuantilesD[4,1] <-Cuantilillos[5];  CuantilesD[4,2] <-Cuantilillos[12]
CuantilesD[5,1] <-Cuantilillos[4];  CuantilesD[5,2] <-Cuantilillos[13]
CuantilesD[6,1] <-Cuantilillos[3];  CuantilesD[6,2] <-Cuantilillos[14]
CuantilesD[7,1] <-Cuantilillos[2];  CuantilesD[7,2] <-Cuantilillos[15]
CuantilesD[8,1] <-Cuantilillos[1];  CuantilesD[8,2] <-Cuantilillos[16]

print(CuantilesD)
##        LimInf    LimSup
## 65 -0.9345893 0.9345893
## 70 -1.0364334 1.0364334
## 75 -1.1503494 1.1503494
## 80 -1.2815516 1.2815516
## 85 -1.4395315 1.4395315
## 90 -1.6448536 1.6448536
## 95 -1.9599640 1.9599640
## 99 -2.5758293 2.5758293
print(CuantilesA)
##        LimInf    LimSup
## 65 -0.8936351 0.8467827
## 70 -0.8936351 0.9884290
## 75 -1.0112465 1.1344069
## 80 -1.0836965 1.3626690
## 85 -1.1697595 1.6777371
## 90 -1.2757625 2.1128235
## 95 -1.6121684 2.5115181
## 99 -1.9690098 3.0656774
col_sequence <- rainbow(n = 7, alpha = 0.35, start = 0, end = 1)
par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2 pEhEx - DATA (sample 2)', lty = 9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[2,1], lty=2, col="darkblue"); # 70% INFERIOR
abline(v=CuantilesA[2,2], lty=2, col="darkblue") # 70% SUPERIOR
abline(v=CuantilesA[3,1], lty=2, col="aquamarine4"); # 75% INFERIOR
abline(v=CuantilesA[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesA[5,1], lty=2, col="brown"); # 85% INFERIOR
abline(v=CuantilesA[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesA[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesA[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesA[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesA[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesA[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesA[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2   pEhEx - ADJUSTED (sample 2)', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[2,1], lty=2, col="darkblue");  # 70% INFERIOR
abline(v=CuantilesD[2,2], lty=2, col="darkblue"); # 70% SUPERIOR
abline(v=CuantilesD[3,1], lty=2, col="aquamarine4");  # 75% INFERIOR
abline(v=CuantilesD[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesD[5,1], lty=2, col="brown");  # 85% INFERIOR
abline(v=CuantilesD[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesD[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesD[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesD[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesD[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesD[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesD[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))

Grafica Cuantiles del \(65\%\) y \(80\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2  pEhEx - DATA (sample 2)', lty=9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2  BaseMean - ADJUSTED (sample 2)', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))

Grafica Cuantiles del \(70\%\) y \(85\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence, 
     main = 'Normalized Log2 pEhEx - DATA (sample 2)', lty=9)

abline(v=CuantilesA[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesA[2,2], lty=2, col="darkblue")
abline(v=CuantilesA[5,1], lty=2, col="brown"); 
abline(v=CuantilesA[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2  pEhEx - ADJUSTED (sample 2)', lty=9)

abline(v=CuantilesD[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesD[2,2], lty=2, col="darkblue")
abline(v=CuantilesD[5,1], lty=2, col="brown"); 
abline(v=CuantilesD[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))

Muestra 3

log2sample3 <- data5$log2sample3; head(mean(log2sample3)); head(sd(log2sample3))
## [1] 6.152478
## [1] 3.158081
head(log2sample3,5)
## [1]  8.904774  5.314000 11.052005  9.365349  5.680082
ndata5    <- length(log2sample3)
hist(log2sample3, breaks = nbreaks, col= rainbow(25,0.3), 
     main = 'Log2 sample2')

meanlog2sample3 <- mean(log2sample3); head(meanlog2sample3)
## [1] 6.152478
StdDevlog2sample3 <- sd(log2sample3); head(StdDevlog2sample3)
## [1] 3.158081
Normlog2sample3 <- (log2sample3-meanlog2sample3)/StdDevlog2sample3; head(Normlog2sample3)
## [1]  0.87150918 -0.26550237  1.55142547  1.01734948 -0.14958317 -0.05720518
tst<- Normlog2sample3
hist(tst, breaks = nbreaks, col= 1:5, 
     main = 'Normalized Log2sample1',
     xlab='pEhEx1',
     ylab= 'Frequency pEhEx')

Ajustando Modelos

fw1<-fitdist(tst, "norm")
plotdist(tst, histo = TRUE, demp = TRUE)

nnorm.f <- fitdist(tst,"norm")
summary(nnorm.f)
## Fitting of the distribution ' norm ' by maximum likelihood 
## Parameters : 
##          estimate Std. Error
## mean 1.292160e-16 0.01425665
## sd   9.998983e-01 0.01008093
## Loglikelihood:  -6979.259   AIC:  13962.52   BIC:  13975.52 
## Correlation matrix:
##              mean           sd
## mean  1.00000e+00 -3.26782e-11
## sd   -3.26782e-11  1.00000e+00
par(mfrow=c(2,2))
denscomp(nnorm.f,legendtext = 'Dist Normal')
qqcomp(nnorm.f,legendtext = 'Dist Normal')
cdfcomp(nnorm.f,legendtext = 'Dist Normal')
ppcomp(nnorm.f,legendtext = 'Dist Normal')

probs <- c();
probs[8] = 0.175;  probs[9] = 0.825; 
probs[7] = 0.15;   probs[10] = 0.85;   
probs[6] = 0.125;  probs[11] = 0.875; 
probs[5] = 0.1;    probs[12] = 0.9;    
probs[4] = 0.075;  probs[13] = 0.925; 
probs[3] = 0.05;   probs[14] = 0.95;   
probs[2] = 0.025;  probs[15] = 0.975; 
probs[1] = 0.005;  probs[16] = 0.995;  
CuantilesData <- quantile(tst,prob = probs)
CuantilesModel <- qnorm(probs, mean=0, sd=1)
Cuantilillos <- t(CuantilesModel)
colnames(Cuantilillos) <- c('0.5%','2.5%','5%','7.5%',
                            '10%','12.5%','15%','17.5%',
                            '82.5%','85%','87.5%','90%',
                            '92.5%','95%','97.5%','99.5%')
Cuantilillos <- t(Cuantilillos)
colnames(Cuantilillos) <- c('Cuantiles Ajuste')
print(Cuantilillos)
##       Cuantiles Ajuste
## 0.5%        -2.5758293
## 2.5%        -1.9599640
## 5%          -1.6448536
## 7.5%        -1.4395315
## 10%         -1.2815516
## 12.5%       -1.1503494
## 15%         -1.0364334
## 17.5%       -0.9345893
## 82.5%        0.9345893
## 85%          1.0364334
## 87.5%        1.1503494
## 90%          1.2815516
## 92.5%        1.4395315
## 95%          1.6448536
## 97.5%        1.9599640
## 99.5%        2.5758293
CuantilesA <- matrix(0,8,2)
CuantilesD <- matrix(0,8,2)
colnames(CuantilesA) <- c('LimInf','LimSup')
colnames(CuantilesD) <- c('LimInf','LimSup')
rownames(CuantilesA) <- c('65','70','75','80','85','90','95','99')
rownames(CuantilesD) <- c('65','70','75','80','85','90','95','99')
CuantilesA[1,1] <-CuantilesData[8]; CuantilesA[1,2] <-CuantilesData[9]
CuantilesA[2,1] <-CuantilesData[7]; CuantilesA[2,2] <-CuantilesData[10]
CuantilesA[3,1] <-CuantilesData[6]; CuantilesA[3,2] <-CuantilesData[11]
CuantilesA[4,1] <-CuantilesData[5]; CuantilesA[4,2] <-CuantilesData[12]
CuantilesA[5,1] <-CuantilesData[4]; CuantilesA[5,2] <-CuantilesData[13]
CuantilesA[6,1] <-CuantilesData[3]; CuantilesA[6,2] <-CuantilesData[14]
CuantilesA[7,1] <-CuantilesData[2]; CuantilesA[7,2] <-CuantilesData[15]
CuantilesA[8,1] <-CuantilesData[1]; CuantilesA[8,2] <-CuantilesData[16]
CuantilesD[1,1] <-Cuantilillos[8];  CuantilesD[1,2] <-Cuantilillos[9]
CuantilesD[2,1] <-Cuantilillos[7];  CuantilesD[2,2] <-Cuantilillos[10]
CuantilesD[3,1] <-Cuantilillos[6];  CuantilesD[3,2] <-Cuantilillos[11]
CuantilesD[4,1] <-Cuantilillos[5];  CuantilesD[4,2] <-Cuantilillos[12]
CuantilesD[5,1] <-Cuantilillos[4];  CuantilesD[5,2] <-Cuantilillos[13]
CuantilesD[6,1] <-Cuantilillos[3];  CuantilesD[6,2] <-Cuantilillos[14]
CuantilesD[7,1] <-Cuantilillos[2];  CuantilesD[7,2] <-Cuantilillos[15]
CuantilesD[8,1] <-Cuantilillos[1];  CuantilesD[8,2] <-Cuantilillos[16]
print(CuantilesD)
##        LimInf    LimSup
## 65 -0.9345893 0.9345893
## 70 -1.0364334 1.0364334
## 75 -1.1503494 1.1503494
## 80 -1.2815516 1.2815516
## 85 -1.4395315 1.4395315
## 90 -1.6448536 1.6448536
## 95 -1.9599640 1.9599640
## 99 -2.5758293 2.5758293
print(CuantilesA)
##        LimInf    LimSup
## 65 -0.8811857 0.8359346
## 70 -0.9495345 0.9646852
## 75 -1.0299396 1.1073525
## 80 -1.1855441 1.3225658
## 85 -1.2519401 1.6081997
## 90 -1.4233556 2.0263238
## 95 -1.7009100 2.4893700
## 99 -1.9481699 3.1039165

Creación de histogramas

col_sequence <- rainbow(n = 7, alpha = 0.35, start = 0, end = 1)
par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2 pEhEx - DATA (sample 3)', lty = 9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[2,1], lty=2, col="darkblue"); # 70% INFERIOR
abline(v=CuantilesA[2,2], lty=2, col="darkblue") # 70% SUPERIOR
abline(v=CuantilesA[3,1], lty=2, col="aquamarine4"); # 75% INFERIOR
abline(v=CuantilesA[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesA[5,1], lty=2, col="brown"); # 85% INFERIOR
abline(v=CuantilesA[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesA[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesA[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesA[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesA[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesA[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesA[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2   pEhEx - ADJUSTED (sample 3)', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[2,1], lty=2, col="darkblue");  # 70% INFERIOR
abline(v=CuantilesD[2,2], lty=2, col="darkblue"); # 70% SUPERIOR
abline(v=CuantilesD[3,1], lty=2, col="aquamarine4");  # 75% INFERIOR
abline(v=CuantilesD[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesD[5,1], lty=2, col="brown");  # 85% INFERIOR
abline(v=CuantilesD[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesD[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesD[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesD[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesD[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesD[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesD[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))

Grafica Cuantiles del \(65\%\) y \(80\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2  pEhEx - DATA (sample 2)', lty=9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2  BaseMean - ADJUSTED (sample 3)', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))

Grafica Cuantiles del \(70\%\) y \(85\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence, 
     main = 'Normalized Log2 pEhEx - DATA (sample 3)', lty=9)

abline(v=CuantilesA[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesA[2,2], lty=2, col="darkblue")
abline(v=CuantilesA[5,1], lty=2, col="brown"); 
abline(v=CuantilesA[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2  pEhEx - ADJUSTED (sample 3)', lty=9)

abline(v=CuantilesD[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesD[2,2], lty=2, col="darkblue")
abline(v=CuantilesD[5,1], lty=2, col="brown"); 
abline(v=CuantilesD[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))

Muestra pEhExvsumasM1

log2vsumasM1 <- data5$log2samplevsumasM1; head(mean(log2vsumasM1)); head(sd(log2vsumasM1))
## [1] 6.221901
## [1] 2.955459
head(log2vsumasM1,5)
## [1] 5.749419 6.889844 9.540979 9.462180 6.904367
ndata5    <- length(log2vsumasM1)
hist(log2vsumasM1, breaks = nbreaks, col= rainbow(25,0.3), 
     main = 'Log2vsumasM1')

meanlog2vsumasM1 <- mean(log2vsumasM1); head(meanlog2vsumasM1)
## [1] 6.221901
StdDevlog2vsumasM1 <- sd(log2vsumasM1); head(StdDevlog2vsumasM1)
## [1] 2.955459
Normlog2vsumasM1 <- (log2vsumasM1-meanlog2vsumasM1)/StdDevlog2vsumasM1; head(Normlog2vsumasM1)
## [1] -0.1598676  0.2260030  1.1230332  1.0963710  0.2309173 -0.1181501
tst<- Normlog2vsumasM1

Primer histograma

hist(tst, breaks = nbreaks, col= 1:5, 
     main = 'Normalized Log2vsumasM1',
     xlab='pEhEx1',
     ylab= 'Frequency pEhEx')

Ajustando modelo

fw1<-fitdist(tst, "norm")
plotdist(tst, histo = TRUE, demp = TRUE)

nnorm.f <- fitdist(tst,"norm")
summary(nnorm.f)
## Fitting of the distribution ' norm ' by maximum likelihood 
## Parameters : 
##           estimate Std. Error
## mean -9.853035e-17 0.01425665
## sd    9.998983e-01 0.01008093
## Loglikelihood:  -6979.259   AIC:  13962.52   BIC:  13975.52 
## Correlation matrix:
##      mean sd
## mean    1  0
## sd      0  1
par(mfrow=c(2,2))
denscomp(nnorm.f,legendtext = 'Dist Normal')
qqcomp(nnorm.f,legendtext = 'Dist Normal')
cdfcomp(nnorm.f,legendtext = 'Dist Normal')
ppcomp(nnorm.f,legendtext = 'Dist Normal')

probs <- c();
probs[8] = 0.175;  probs[9] = 0.825; 
probs[7] = 0.15;   probs[10] = 0.85;   
probs[6] = 0.125;  probs[11] = 0.875; 
probs[5] = 0.1;    probs[12] = 0.9;    
probs[4] = 0.075;  probs[13] = 0.925; 
probs[3] = 0.05;   probs[14] = 0.95;   
probs[2] = 0.025;  probs[15] = 0.975; 
probs[1] = 0.005;  probs[16] = 0.995;  
CuantilesData <- quantile(tst,prob = probs)
CuantilesModel <- qnorm(probs, mean=0, sd=1)
Cuantilillos <- t(CuantilesModel)
colnames(Cuantilillos) <- c('0.5%','2.5%','5%','7.5%',
                            '10%','12.5%','15%','17.5%',
                            '82.5%','85%','87.5%','90%',
                            '92.5%','95%','97.5%','99.5%')
Cuantilillos <- t(Cuantilillos)
colnames(Cuantilillos) <- c('Cuantiles Ajuste')
print(Cuantilillos)
##       Cuantiles Ajuste
## 0.5%        -2.5758293
## 2.5%        -1.9599640
## 5%          -1.6448536
## 7.5%        -1.4395315
## 10%         -1.2815516
## 12.5%       -1.1503494
## 15%         -1.0364334
## 17.5%       -0.9345893
## 82.5%        0.9345893
## 85%          1.0364334
## 87.5%        1.1503494
## 90%          1.2815516
## 92.5%        1.4395315
## 95%          1.6448536
## 97.5%        1.9599640
## 99.5%        2.5758293
CuantilesA <- matrix(0,8,2)
CuantilesD <- matrix(0,8,2)
colnames(CuantilesA) <- c('LimInf','LimSup')
colnames(CuantilesD) <- c('LimInf','LimSup')
rownames(CuantilesA) <- c('65','70','75','80','85','90','95','99')
rownames(CuantilesD) <- c('65','70','75','80','85','90','95','99')
CuantilesA[1,1] <-CuantilesData[8]; CuantilesA[1,2] <-CuantilesData[9]
CuantilesA[2,1] <-CuantilesData[7]; CuantilesA[2,2] <-CuantilesData[10]
CuantilesA[3,1] <-CuantilesData[6]; CuantilesA[3,2] <-CuantilesData[11]
CuantilesA[4,1] <-CuantilesData[5]; CuantilesA[4,2] <-CuantilesData[12]
CuantilesA[5,1] <-CuantilesData[4]; CuantilesA[5,2] <-CuantilesData[13]
CuantilesA[6,1] <-CuantilesData[3]; CuantilesA[6,2] <-CuantilesData[14]
CuantilesA[7,1] <-CuantilesData[2]; CuantilesA[7,2] <-CuantilesData[15]
CuantilesA[8,1] <-CuantilesData[1]; CuantilesA[8,2] <-CuantilesData[16]
CuantilesD[1,1] <-Cuantilillos[8];  CuantilesD[1,2] <-Cuantilillos[9]
CuantilesD[2,1] <-Cuantilillos[7];  CuantilesD[2,2] <-Cuantilillos[10]
CuantilesD[3,1] <-Cuantilillos[6];  CuantilesD[3,2] <-Cuantilillos[11]
CuantilesD[4,1] <-Cuantilillos[5];  CuantilesD[4,2] <-Cuantilillos[12]
CuantilesD[5,1] <-Cuantilillos[4];  CuantilesD[5,2] <-Cuantilillos[13]
CuantilesD[6,1] <-Cuantilillos[3];  CuantilesD[6,2] <-Cuantilillos[14]
CuantilesD[7,1] <-Cuantilillos[2];  CuantilesD[7,2] <-Cuantilillos[15]
CuantilesD[8,1] <-Cuantilillos[1];  CuantilesD[8,2] <-Cuantilillos[16]
print(CuantilesD)
##        LimInf    LimSup
## 65 -0.9345893 0.9345893
## 70 -1.0364334 1.0364334
## 75 -1.1503494 1.1503494
## 80 -1.2815516 1.2815516
## 85 -1.4395315 1.4395315
## 90 -1.6448536 1.6448536
## 95 -1.9599640 1.9599640
## 99 -2.5758293 2.5758293
print(CuantilesA)
##        LimInf    LimSup
## 65 -0.8531906 0.8236011
## 70 -0.9004672 0.9332295
## 75 -0.9528182 1.1118993
## 80 -0.9528182 1.3280269
## 85 -1.0781339 1.6545578
## 90 -1.1553694 2.1045904
## 95 -1.3603164 2.6974724
## 99 -2.1052233 3.3025359

Histogramas

col_sequence <- rainbow(n = 7, alpha = 0.35, start = 0, end = 1)
par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsumasM1 pEhEx - DATA', lty = 9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[2,1], lty=2, col="darkblue"); # 70% INFERIOR
abline(v=CuantilesA[2,2], lty=2, col="darkblue") # 70% SUPERIOR
abline(v=CuantilesA[3,1], lty=2, col="aquamarine4"); # 75% INFERIOR
abline(v=CuantilesA[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesA[5,1], lty=2, col="brown"); # 85% INFERIOR
abline(v=CuantilesA[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesA[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesA[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesA[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesA[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesA[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesA[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsumasM1   pEhEx - ADJUSTED', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[2,1], lty=2, col="darkblue");  # 70% INFERIOR
abline(v=CuantilesD[2,2], lty=2, col="darkblue"); # 70% SUPERIOR
abline(v=CuantilesD[3,1], lty=2, col="aquamarine4");  # 75% INFERIOR
abline(v=CuantilesD[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesD[5,1], lty=2, col="brown");  # 85% INFERIOR
abline(v=CuantilesD[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesD[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesD[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesD[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesD[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesD[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesD[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))

Grafica Cuantiles del \(65\%\) y \(80\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsumasM1  pEhEx - DATA', lty=9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsumasM1  - ADJUSTED', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))

Grafica Cuantiles del \(70\%\) y \(85\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence, 
     main = 'Normalized Log2vsumasM1 pEhEx - DATA', lty=9)

abline(v=CuantilesA[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesA[2,2], lty=2, col="darkblue")
abline(v=CuantilesA[5,1], lty=2, col="brown"); 
abline(v=CuantilesA[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsumasM1  pEhEx - ADJUSTED', lty=9)

abline(v=CuantilesD[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesD[2,2], lty=2, col="darkblue")
abline(v=CuantilesD[5,1], lty=2, col="brown"); 
abline(v=CuantilesD[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))

Muestra pEhExvsumasM2

log2vsumasM2 <- data5$log2samplevsumasM2; head(mean(log2vsumasM2)); head(sd(log2vsumasM2))
## [1] 6.255602
## [1] 2.72471
head(log2vsumasM2,5)
## [1]  8.745886  8.538024 10.187333  7.740125  6.603402

Primer Histograma

ndata5    <- length(log2vsumasM2)
hist(log2vsumasM2, breaks = nbreaks, col= rainbow(25,0.3), 
     main = 'Log2vsumasM2')

meanlog2vsumasM2 <- mean(log2vsumasM2); head(meanlog2vsumasM2)
## [1] 6.255602
StdDevlog2vsumasM2 <- sd(log2vsumasM2); head(StdDevlog2vsumasM2)
## [1] 2.72471
Normlog2vsumasM2 <- (log2vsumasM2-meanlog2vsumasM2)/StdDevlog2vsumasM2; head(Normlog2vsumasM2)
## [1]  0.9139630  0.8376754  1.4429905  0.5448372  0.1276466 -0.1223761
tst<- Normlog2vsumasM2

** Segundo Histograma**

hist(tst, breaks = nbreaks, col= 1:5, 
     main = 'Normalized Log2vsumasM2',
     xlab='pEhEx1',
     ylab= 'Frequency pEhEx')

Ajustando modelo

fw1<-fitdist(tst, "norm")
plotdist(tst, histo = TRUE, demp = TRUE)

nnorm.f <- fitdist(tst,"norm")
summary(nnorm.f)
## Fitting of the distribution ' norm ' by maximum likelihood 
## Parameters : 
##          estimate Std. Error
## mean 1.626526e-16 0.01425665
## sd   9.998983e-01 0.01008093
## Loglikelihood:  -6979.259   AIC:  13962.52   BIC:  13975.52 
## Correlation matrix:
##      mean sd
## mean    1  0
## sd      0  1
par(mfrow=c(2,2))
denscomp(nnorm.f,legendtext = 'Dist Normal')
qqcomp(nnorm.f,legendtext = 'Dist Normal')
cdfcomp(nnorm.f,legendtext = 'Dist Normal')
ppcomp(nnorm.f,legendtext = 'Dist Normal')

Cálculo de cuantiles

probs <- c();
probs[8] = 0.175;  probs[9] = 0.825; 
probs[7] = 0.15;   probs[10] = 0.85;   
probs[6] = 0.125;  probs[11] = 0.875; 
probs[5] = 0.1;    probs[12] = 0.9;    
probs[4] = 0.075;  probs[13] = 0.925; 
probs[3] = 0.05;   probs[14] = 0.95;   
probs[2] = 0.025;  probs[15] = 0.975; 
probs[1] = 0.005;  probs[16] = 0.995;  
CuantilesData <- quantile(tst,prob = probs)
CuantilesModel <- qnorm(probs, mean=0, sd=1)
Cuantilillos <- t(CuantilesModel)
colnames(Cuantilillos) <- c('0.5%','2.5%','5%','7.5%',
                            '10%','12.5%','15%','17.5%',
                            '82.5%','85%','87.5%','90%',
                            '92.5%','95%','97.5%','99.5%')
Cuantilillos <- t(Cuantilillos)
colnames(Cuantilillos) <- c('Cuantiles Ajuste')
print(Cuantilillos)
##       Cuantiles Ajuste
## 0.5%        -2.5758293
## 2.5%        -1.9599640
## 5%          -1.6448536
## 7.5%        -1.4395315
## 10%         -1.2815516
## 12.5%       -1.1503494
## 15%         -1.0364334
## 17.5%       -0.9345893
## 82.5%        0.9345893
## 85%          1.0364334
## 87.5%        1.1503494
## 90%          1.2815516
## 92.5%        1.4395315
## 95%          1.6448536
## 97.5%        1.9599640
## 99.5%        2.5758293
CuantilesA <- matrix(0,8,2)
CuantilesD <- matrix(0,8,2)
colnames(CuantilesA) <- c('LimInf','LimSup')
colnames(CuantilesD) <- c('LimInf','LimSup')
rownames(CuantilesA) <- c('65','70','75','80','85','90','95','99')
rownames(CuantilesD) <- c('65','70','75','80','85','90','95','99')
CuantilesA[1,1] <-CuantilesData[8]; CuantilesA[1,2] <-CuantilesData[9]
CuantilesA[2,1] <-CuantilesData[7]; CuantilesA[2,2] <-CuantilesData[10]
CuantilesA[3,1] <-CuantilesData[6]; CuantilesA[3,2] <-CuantilesData[11]
CuantilesA[4,1] <-CuantilesData[5]; CuantilesA[4,2] <-CuantilesData[12]
CuantilesA[5,1] <-CuantilesData[4]; CuantilesA[5,2] <-CuantilesData[13]
CuantilesA[6,1] <-CuantilesData[3]; CuantilesA[6,2] <-CuantilesData[14]
CuantilesA[7,1] <-CuantilesData[2]; CuantilesA[7,2] <-CuantilesData[15]
CuantilesA[8,1] <-CuantilesData[1]; CuantilesA[8,2] <-CuantilesData[16]
CuantilesD[1,1] <-Cuantilillos[8];  CuantilesD[1,2] <-Cuantilillos[9]
CuantilesD[2,1] <-Cuantilillos[7];  CuantilesD[2,2] <-Cuantilillos[10]
CuantilesD[3,1] <-Cuantilillos[6];  CuantilesD[3,2] <-Cuantilillos[11]
CuantilesD[4,1] <-Cuantilillos[5];  CuantilesD[4,2] <-Cuantilillos[12]
CuantilesD[5,1] <-Cuantilillos[4];  CuantilesD[5,2] <-Cuantilillos[13]
CuantilesD[6,1] <-Cuantilillos[3];  CuantilesD[6,2] <-Cuantilillos[14]
CuantilesD[7,1] <-Cuantilillos[2];  CuantilesD[7,2] <-Cuantilillos[15]
CuantilesD[8,1] <-Cuantilillos[1];  CuantilesD[8,2] <-Cuantilillos[16]
print(CuantilesD)
##        LimInf    LimSup
## 65 -0.9345893 0.9345893
## 70 -1.0364334 1.0364334
## 75 -1.1503494 1.1503494
## 80 -1.2815516 1.2815516
## 85 -1.4395315 1.4395315
## 90 -1.6448536 1.6448536
## 95 -1.9599640 1.9599640
## 99 -2.5758293 2.5758293
print(CuantilesA)
##        LimInf    LimSup
## 65 -0.8779788 0.8200071
## 70 -0.9297388 0.9699103
## 75 -0.9871123 1.1247423
## 80 -1.0514667 1.3424300
## 85 -1.1247392 1.7188713
## 90 -1.2098054 2.1841922
## 95 -1.3112040 2.5940822
## 99 -1.8422575 3.1504680

Histogramas

col_sequence <- rainbow(n = 7, alpha = 0.35, start = 0, end = 1)
par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsumasM2 pEhEx - DATA', lty = 9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[2,1], lty=2, col="darkblue"); # 70% INFERIOR
abline(v=CuantilesA[2,2], lty=2, col="darkblue") # 70% SUPERIOR
abline(v=CuantilesA[3,1], lty=2, col="aquamarine4"); # 75% INFERIOR
abline(v=CuantilesA[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesA[5,1], lty=2, col="brown"); # 85% INFERIOR
abline(v=CuantilesA[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesA[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesA[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesA[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesA[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesA[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesA[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsumasM2   pEhEx - ADJUSTED', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[2,1], lty=2, col="darkblue");  # 70% INFERIOR
abline(v=CuantilesD[2,2], lty=2, col="darkblue"); # 70% SUPERIOR
abline(v=CuantilesD[3,1], lty=2, col="aquamarine4");  # 75% INFERIOR
abline(v=CuantilesD[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesD[5,1], lty=2, col="brown");  # 85% INFERIOR
abline(v=CuantilesD[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesD[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesD[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesD[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesD[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesD[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesD[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))

Grafica Cuantiles del \(65\%\) y \(80\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsumasM2  pEhEx - DATA', lty=9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsumasM2  - ADJUSTED', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))

Grafica Cuantiles del \(70\%\) y \(85\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence, 
     main = 'Normalized Log2vsumasM2 pEhEx - DATA', lty=9)

abline(v=CuantilesA[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesA[2,2], lty=2, col="darkblue")
abline(v=CuantilesA[5,1], lty=2, col="brown"); 
abline(v=CuantilesA[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsumasM2  pEhEx - ADJUSTED', lty=9)

abline(v=CuantilesD[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesD[2,2], lty=2, col="darkblue")
abline(v=CuantilesD[5,1], lty=2, col="brown"); 
abline(v=CuantilesD[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))

Muestra pEhExvsumasM3

log2vsumasM3 <- data5$log2samplevsumasM3; head(mean(log2vsumasM3)); head(sd(log2vsumasM3))
## [1] 6.317092
## [1] 3.410882
head(log2vsumasM3,5)
## [1]  9.778619  5.482538 12.794720 10.625030  7.128629
ndata5    <- length(log2vsumasM3)

** Primer histograma**

hist(log2vsumasM3, breaks = nbreaks, col= rainbow(25,0.3), 
     main = 'Log2vsumasM3')

meanlog2vsumasM3 <- mean(log2vsumasM3); head(meanlog2vsumasM3)
## [1] 6.317092
StdDevlog2vsumasM3 <- sd(log2vsumasM3); head(StdDevlog2vsumasM3)
## [1] 3.410882
Normlog2vsumasM3 <- (log2vsumasM3-meanlog2vsumasM3)/StdDevlog2vsumasM3; head(Normlog2vsumasM3)
## [1]  1.0148481 -0.2446740  1.8991065  1.2629984  0.2379259 -0.3441057
tst<- Normlog2vsumasM3

Segundo histograma

hist(tst, breaks = nbreaks, col= 1:5, 
     main = 'Normalized Log2vsumasM3',
     xlab='pEhEx1',
     ylab= 'Frequency pEhEx')

Ajustando modelo

fw1<-fitdist(tst, "norm")
plotdist(tst, histo = TRUE, demp = TRUE)

nnorm.f <- fitdist(tst,"norm")
summary(nnorm.f)
## Fitting of the distribution ' norm ' by maximum likelihood 
## Parameters : 
##           estimate Std. Error
## mean -2.967667e-17 0.01425665
## sd    9.998983e-01 0.01008093
## Loglikelihood:  -6979.259   AIC:  13962.52   BIC:  13975.52 
## Correlation matrix:
##      mean sd
## mean    1  0
## sd      0  1
par(mfrow=c(2,2))
denscomp(nnorm.f,legendtext = 'Dist Normal')
qqcomp(nnorm.f,legendtext = 'Dist Normal')
cdfcomp(nnorm.f,legendtext = 'Dist Normal')
ppcomp(nnorm.f,legendtext = 'Dist Normal')

Calculo de cuantiles

probs <- c();
probs[8] = 0.175;  probs[9] = 0.825; 
probs[7] = 0.15;   probs[10] = 0.85;   
probs[6] = 0.125;  probs[11] = 0.875; 
probs[5] = 0.1;    probs[12] = 0.9;    
probs[4] = 0.075;  probs[13] = 0.925; 
probs[3] = 0.05;   probs[14] = 0.95;   
probs[2] = 0.025;  probs[15] = 0.975; 
probs[1] = 0.005;  probs[16] = 0.995;  
CuantilesData <- quantile(tst,prob = probs)
CuantilesModel <- qnorm(probs, mean=0, sd=1)
Cuantilillos <- t(CuantilesModel)
colnames(Cuantilillos) <- c('0.5%','2.5%','5%','7.5%',
                            '10%','12.5%','15%','17.5%',
                            '82.5%','85%','87.5%','90%',
                            '92.5%','95%','97.5%','99.5%')
Cuantilillos <- t(Cuantilillos)
colnames(Cuantilillos) <- c('Cuantiles Ajuste')
print(Cuantilillos)
##       Cuantiles Ajuste
## 0.5%        -2.5758293
## 2.5%        -1.9599640
## 5%          -1.6448536
## 7.5%        -1.4395315
## 10%         -1.2815516
## 12.5%       -1.1503494
## 15%         -1.0364334
## 17.5%       -0.9345893
## 82.5%        0.9345893
## 85%          1.0364334
## 87.5%        1.1503494
## 90%          1.2815516
## 92.5%        1.4395315
## 95%          1.6448536
## 97.5%        1.9599640
## 99.5%        2.5758293
CuantilesA <- matrix(0,8,2)
CuantilesD <- matrix(0,8,2)
colnames(CuantilesA) <- c('LimInf','LimSup')
colnames(CuantilesD) <- c('LimInf','LimSup')
rownames(CuantilesA) <- c('65','70','75','80','85','90','95','99')
rownames(CuantilesD) <- c('65','70','75','80','85','90','95','99')
CuantilesA[1,1] <-CuantilesData[8]; CuantilesA[1,2] <-CuantilesData[9]
CuantilesA[2,1] <-CuantilesData[7]; CuantilesA[2,2] <-CuantilesData[10]
CuantilesA[3,1] <-CuantilesData[6]; CuantilesA[3,2] <-CuantilesData[11]
CuantilesA[4,1] <-CuantilesData[5]; CuantilesA[4,2] <-CuantilesData[12]
CuantilesA[5,1] <-CuantilesData[4]; CuantilesA[5,2] <-CuantilesData[13]
CuantilesA[6,1] <-CuantilesData[3]; CuantilesA[6,2] <-CuantilesData[14]
CuantilesA[7,1] <-CuantilesData[2]; CuantilesA[7,2] <-CuantilesData[15]
CuantilesA[8,1] <-CuantilesData[1]; CuantilesA[8,2] <-CuantilesData[16]
CuantilesD[1,1] <-Cuantilillos[8];  CuantilesD[1,2] <-Cuantilillos[9]
CuantilesD[2,1] <-Cuantilillos[7];  CuantilesD[2,2] <-Cuantilillos[10]
CuantilesD[3,1] <-Cuantilillos[6];  CuantilesD[3,2] <-Cuantilillos[11]
CuantilesD[4,1] <-Cuantilillos[5];  CuantilesD[4,2] <-Cuantilillos[12]
CuantilesD[5,1] <-Cuantilillos[4];  CuantilesD[5,2] <-Cuantilillos[13]
CuantilesD[6,1] <-Cuantilillos[3];  CuantilesD[6,2] <-Cuantilillos[14]
CuantilesD[7,1] <-Cuantilillos[2];  CuantilesD[7,2] <-Cuantilillos[15]
CuantilesD[8,1] <-Cuantilillos[1];  CuantilesD[8,2] <-Cuantilillos[16]
print(CuantilesD)
##        LimInf    LimSup
## 65 -0.9345893 0.9345893
## 70 -1.0364334 1.0364334
## 75 -1.1503494 1.1503494
## 80 -1.2815516 1.2815516
## 85 -1.4395315 1.4395315
## 90 -1.6448536 1.6448536
## 95 -1.9599640 1.9599640
## 99 -2.5758293 2.5758293
print(CuantilesA)
##        LimInf    LimSup
## 65 -0.8628952 0.8884901
## 70 -0.9319289 1.0207444
## 75 -1.0144701 1.1904247
## 80 -1.1171230 1.3814634
## 85 -1.2529569 1.6102025
## 90 -1.4542681 1.9460444
## 95 -1.8520407 2.4110529
## 99 -1.8520407 3.0342081

Histogramas

col_sequence <- rainbow(n = 7, alpha = 0.35, start = 0, end = 1)
par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsumasM3 pEhEx - DATA', lty = 9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[2,1], lty=2, col="darkblue"); # 70% INFERIOR
abline(v=CuantilesA[2,2], lty=2, col="darkblue") # 70% SUPERIOR
abline(v=CuantilesA[3,1], lty=2, col="aquamarine4"); # 75% INFERIOR
abline(v=CuantilesA[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesA[5,1], lty=2, col="brown"); # 85% INFERIOR
abline(v=CuantilesA[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesA[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesA[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesA[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesA[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesA[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesA[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsumasM3   pEhEx - ADJUSTED', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[2,1], lty=2, col="darkblue");  # 70% INFERIOR
abline(v=CuantilesD[2,2], lty=2, col="darkblue"); # 70% SUPERIOR
abline(v=CuantilesD[3,1], lty=2, col="aquamarine4");  # 75% INFERIOR
abline(v=CuantilesD[3,2], lty=2, col="aquamarine4"); # 75% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
abline(v=CuantilesD[5,1], lty=2, col="brown");  # 85% INFERIOR
abline(v=CuantilesD[5,2], lty=2, col="brown"); # 85% SUPERIOR
abline(v=CuantilesD[6,1], lty=2, col="red");  # 90% INFERIOR
abline(v=CuantilesD[6,2], lty=2, col="red"); # 90% SUPERIOR
abline(v=CuantilesD[7,1], lty=2, col="blue");  # 95% INFERIOR
abline(v=CuantilesD[7,2], lty=2, col="blue"); # 95% SUPERIOR
abline(v=CuantilesD[8,1], lty=2, col="orange");  # 99% INFERIOR
abline(v=CuantilesD[8,2], lty=2, col="orange"); # 99% SUPERIOR
legend("topright",
       legend=c("65%","70%","75%","80%","85%","90%","95%","99%"), 
       pch=c(1,2,3,4,5,6,7,8),
       col=c("darkgoldenrod4","darkblue","aquamarine4",
             "green", "brown","red","blue","orange"))

Grafica Cuantiles del \(65\%\) y \(80\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsumasM3  pEhEx - DATA', lty=9)

abline(v=CuantilesA[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesA[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesA[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesA[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsumasM1  - ADJUSTED', lty=9)

abline(v=CuantilesD[1,1], lty=2, col="darkgoldenrod4"); # 65% INFERIOR
abline(v=CuantilesD[1,2], lty=2, col="darkgoldenrod4"); # 65% SUPERIOR
abline(v=CuantilesD[4,1], lty=2, col="green");  # 80% INFERIOR
abline(v=CuantilesD[4,2], lty=2, col="green"); # 80% SUPERIOR
legend("topright",legend=c("65%","80%"), 
       pch=c(1,2),col=c("darkgoldenrod4","green"))

Grafica Cuantiles del \(70\%\) y \(85\%\)

par(mfrow=c(2,1))
hist(tst, breaks = nbreaks, col = col_sequence, 
     main = 'Normalized Log2vsumasM3 pEhEx - DATA', lty=9)

abline(v=CuantilesA[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesA[2,2], lty=2, col="darkblue")
abline(v=CuantilesA[5,1], lty=2, col="brown"); 
abline(v=CuantilesA[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))
hist(tst, breaks = nbreaks, col = col_sequence,
     main = 'Normalized Log2vsumasM3  pEhEx - ADJUSTED', lty=9)

abline(v=CuantilesD[2,1], lty=2, col="darkblue"); 
abline(v=CuantilesD[2,2], lty=2, col="darkblue")
abline(v=CuantilesD[5,1], lty=2, col="brown"); 
abline(v=CuantilesD[5,2], lty=2, col="brown")
legend("topright",legend=c("70%","85%"),
       pch=c(1,2),#3,4,5,6,7,8),
       col=c("brown"))